tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

getter-duplicates.js (1200B)


      1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 12.2.5
      5 description: >
      6    In an object, duplicate computed property getter names produce only a single property of
      7    that name, whose value is the value of the last property of that name.
      8 ---*/
      9 var A = {
     10  get ['a']() {
     11    return 'A';
     12  }
     13 };
     14 assert.sameValue(A.a, 'A', "The value of `A.a` is `'A'`");
     15 
     16 var B = {
     17  get b() {
     18    throw new Test262Error("The `b` getter definition in `B` is unreachable");
     19  },
     20  get ['b']() {
     21    return 'B';
     22  }
     23 };
     24 assert.sameValue(B.b, 'B', "The value of `B.b` is `'B'`");
     25 
     26 var C = {
     27  get c() {
     28    throw new Test262Error("The `c` getter definition in `C` is unreachable");
     29  },
     30  get ['c']() {
     31    throw new Test262Error("The `['c']` getter definition in `C` is unreachable");
     32  },
     33  get ['c']() {
     34    return 'C';
     35  }
     36 };
     37 assert.sameValue(C.c, 'C', "The value of `C.c` is `'C'`");
     38 
     39 var D = {
     40  get ['d']() {
     41    throw new Test262Error("The `['d']` getter definition in `D` is unreachable");
     42  },
     43  get d() {
     44    return 'D';
     45  }
     46 };
     47 assert.sameValue(D.d, 'D', "The value of `D.d` is `'D'`");
     48 
     49 reportCompare(0, 0);