tor-browser

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

call-spread-obj-getter-init.js (1133B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/spread/obj-getter-init.case
      3 // - src/spread/default/super-call.template
      4 /*---
      5 description: Getter in object literal is not evaluated (SuperCall)
      6 esid: sec-super-keyword-runtime-semantics-evaluation
      7 features: [object-spread]
      8 flags: [generated]
      9 info: |
     10    SuperCall : super Arguments
     11 
     12    1. Let newTarget be GetNewTarget().
     13    2. If newTarget is undefined, throw a ReferenceError exception.
     14    3. Let func be GetSuperConstructor().
     15    4. ReturnIfAbrupt(func).
     16    5. Let argList be ArgumentListEvaluation of Arguments.
     17    [...]
     18 ---*/
     19 
     20 let o = {a: 2, b: 3};
     21 let executedGetter = false;
     22 
     23 
     24 var callCount = 0;
     25 
     26 class Test262ParentClass {
     27  constructor(obj) {
     28    assert.sameValue(obj.a, 2);
     29    assert.sameValue(obj.b, 3);
     30    assert.sameValue(executedGetter, false)
     31    assert.sameValue(Object.keys(obj).length, 3);
     32    callCount += 1;
     33  }
     34 }
     35 
     36 class Test262ChildClass extends Test262ParentClass {
     37  constructor() {
     38    super({...o, get c() { executedGetter = true; }});
     39  }
     40 }
     41 
     42 new Test262ChildClass();
     43 assert.sameValue(callCount, 1);
     44 
     45 reportCompare(0, 0);