tor-browser

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

spread-mult-iter.js (1823B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/spread/mult-iter.case
      3 // - src/spread/default/member-expr.template
      4 /*---
      5 description: Spread operator following other arguments with a valid iterator (`new` operator)
      6 esid: sec-new-operator-runtime-semantics-evaluation
      7 features: [Symbol.iterator]
      8 flags: [generated]
      9 info: |
     10    MemberExpression : new MemberExpression Arguments
     11 
     12    1. Return EvaluateNew(MemberExpression, Arguments).
     13 
     14    12.3.3.1.1 Runtime Semantics: EvaluateNew
     15 
     16    6. If arguments is empty, let argList be an empty List.
     17    7. Else,
     18       a. Let argList be ArgumentListEvaluation of arguments.
     19       [...]
     20 
     21    12.3.6.1 Runtime Semantics: ArgumentListEvaluation
     22 
     23    ArgumentList : ... AssignmentExpression
     24 
     25    1. Let list be an empty List.
     26    2. Let spreadRef be the result of evaluating AssignmentExpression.
     27    3. Let spreadObj be GetValue(spreadRef).
     28    4. Let iterator be GetIterator(spreadObj).
     29    5. ReturnIfAbrupt(iterator).
     30    6. Repeat
     31       a. Let next be IteratorStep(iterator).
     32       b. ReturnIfAbrupt(next).
     33       c. If next is false, return list.
     34       d. Let nextArg be IteratorValue(next).
     35       e. ReturnIfAbrupt(nextArg).
     36       f. Append nextArg as the last element of list.
     37 ---*/
     38 var iter = {};
     39 iter[Symbol.iterator] = function() {
     40  var nextCount = 3;
     41  return {
     42    next: function() {
     43      nextCount += 1;
     44      return { done: nextCount === 6, value: nextCount };
     45    }
     46  };
     47 };
     48 
     49 var callCount = 0;
     50 
     51 new function() {
     52  assert.sameValue(arguments.length, 5);
     53  assert.sameValue(arguments[0], 1);
     54  assert.sameValue(arguments[1], 2);
     55  assert.sameValue(arguments[2], 3);
     56  assert.sameValue(arguments[3], 4);
     57  assert.sameValue(arguments[4], 5);
     58  callCount += 1;
     59 }(1, 2, 3, ...iter);
     60 
     61 assert.sameValue(callCount, 1);
     62 
     63 reportCompare(0, 0);