tor-browser

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

call-spread-obj-with-overrides.js (1791B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/spread/obj-with-overrides.case
      3 // - src/spread/default/super-call.template
      4 /*---
      5 description: Object Spread properties being overriden (SuperCall)
      6 esid: sec-super-keyword-runtime-semantics-evaluation
      7 features: [Symbol, 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    Pending Runtime Semantics: PropertyDefinitionEvaluation
     20 
     21    PropertyDefinition:...AssignmentExpression
     22 
     23    1. Let exprValue be the result of evaluating AssignmentExpression.
     24    2. Let fromValue be GetValue(exprValue).
     25    3. ReturnIfAbrupt(fromValue).
     26    4. Let excludedNames be a new empty List.
     27    5. Return CopyDataProperties(object, fromValue, excludedNames).
     28 
     29 ---*/
     30 let o = {a: 2, b: 3, c: 4, e: undefined, f: null, g: false};
     31 
     32 
     33 var callCount = 0;
     34 
     35 class Test262ParentClass {
     36  constructor(obj) {
     37    assert.sameValue(obj.a, 1);
     38    assert.sameValue(obj.b, 7);
     39    assert.sameValue(obj.c, 4);
     40    assert.sameValue(obj.d, 5);
     41    assert(obj.hasOwnProperty("e"));
     42    assert.sameValue(obj.f, null);
     43    assert.sameValue(obj.g, false);
     44    assert.sameValue(obj.h, -0);
     45    assert.sameValue(obj.i.toString(), "Symbol(foo)");
     46    assert(Object.is(obj.j, o));
     47    assert.sameValue(Object.keys(obj).length, 10);
     48    callCount += 1;
     49  }
     50 }
     51 
     52 class Test262ChildClass extends Test262ParentClass {
     53  constructor() {
     54    super({...o, a: 1, b: 7, d: 5, h: -0, i: Symbol("foo"), j: o});
     55  }
     56 }
     57 
     58 new Test262ChildClass();
     59 assert.sameValue(callCount, 1);
     60 
     61 reportCompare(0, 0);