tor-browser

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

call-spread-mult-iter.js (1951B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/spread/mult-iter.case
      3 // - src/spread/default/super-call.template
      4 /*---
      5 description: Spread operator following other arguments with a valid iterator (SuperCall)
      6 esid: sec-super-keyword-runtime-semantics-evaluation
      7 features: [Symbol.iterator]
      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    12.3.6.1 Runtime Semantics: ArgumentListEvaluation
     20 
     21    ArgumentList : ... AssignmentExpression
     22 
     23    1. Let list be an empty List.
     24    2. Let spreadRef be the result of evaluating AssignmentExpression.
     25    3. Let spreadObj be GetValue(spreadRef).
     26    4. Let iterator be GetIterator(spreadObj).
     27    5. ReturnIfAbrupt(iterator).
     28    6. Repeat
     29       a. Let next be IteratorStep(iterator).
     30       b. ReturnIfAbrupt(next).
     31       c. If next is false, return list.
     32       d. Let nextArg be IteratorValue(next).
     33       e. ReturnIfAbrupt(nextArg).
     34       f. Append nextArg as the last element of list.
     35 ---*/
     36 var iter = {};
     37 iter[Symbol.iterator] = function() {
     38  var nextCount = 3;
     39  return {
     40    next: function() {
     41      nextCount += 1;
     42      return { done: nextCount === 6, value: nextCount };
     43    }
     44  };
     45 };
     46 
     47 var callCount = 0;
     48 
     49 class Test262ParentClass {
     50  constructor() {
     51    assert.sameValue(arguments.length, 5);
     52    assert.sameValue(arguments[0], 1);
     53    assert.sameValue(arguments[1], 2);
     54    assert.sameValue(arguments[2], 3);
     55    assert.sameValue(arguments[3], 4);
     56    assert.sameValue(arguments[4], 5);
     57    callCount += 1;
     58  }
     59 }
     60 
     61 class Test262ChildClass extends Test262ParentClass {
     62  constructor() {
     63    super(1, 2, 3, ...iter);
     64  }
     65 }
     66 
     67 new Test262ChildClass();
     68 assert.sameValue(callCount, 1);
     69 
     70 reportCompare(0, 0);