tor-browser

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

call-spread-obj-spread-order.js (1693B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/spread/obj-spread-order.case
      3 // - src/spread/default/super-call.template
      4 /*---
      5 description: Spread operation follows [[OwnPropertyKeys]] order (SuperCall)
      6 esid: sec-super-keyword-runtime-semantics-evaluation
      7 features: [Symbol, object-spread]
      8 flags: [generated]
      9 includes: [compareArray.js]
     10 info: |
     11    SuperCall : super Arguments
     12 
     13    1. Let newTarget be GetNewTarget().
     14    2. If newTarget is undefined, throw a ReferenceError exception.
     15    3. Let func be GetSuperConstructor().
     16    4. ReturnIfAbrupt(func).
     17    5. Let argList be ArgumentListEvaluation of Arguments.
     18    [...]
     19 
     20    Pending Runtime Semantics: PropertyDefinitionEvaluation
     21 
     22    PropertyDefinition:...AssignmentExpression
     23 
     24    1. Let exprValue be the result of evaluating AssignmentExpression.
     25    2. Let fromValue be GetValue(exprValue).
     26    3. ReturnIfAbrupt(fromValue).
     27    4. Let excludedNames be a new empty List.
     28    5. Return CopyDataProperties(object, fromValue, excludedNames).
     29 
     30 ---*/
     31 var calls = [];
     32 var o = { get z() { calls.push('z') }, get a() { calls.push('a') } };
     33 Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true });
     34 Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true });
     35 
     36 
     37 var callCount = 0;
     38 
     39 class Test262ParentClass {
     40  constructor(obj) {
     41    assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]);
     42    assert.sameValue(Object.keys(obj).length, 3);
     43    callCount += 1;
     44  }
     45 }
     46 
     47 class Test262ChildClass extends Test262ParentClass {
     48  constructor() {
     49    super({...o});
     50  }
     51 }
     52 
     53 new Test262ChildClass();
     54 assert.sameValue(callCount, 1);
     55 
     56 reportCompare(0, 0);