tor-browser

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

spread-err-sngl-err-itr-step.js (1839B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/spread/sngl-err-itr-step.case
      3 // - src/spread/error/array.template
      4 /*---
      5 description: Spread operator applied to the only argument when IteratorStep fails (Array initializer)
      6 esid: sec-runtime-semantics-arrayaccumulation
      7 features: [Symbol.iterator]
      8 flags: [generated]
      9 info: |
     10    SpreadElement : ...AssignmentExpression
     11 
     12    1. Let spreadRef be the result of evaluating AssignmentExpression.
     13    2. Let spreadObj be ? GetValue(spreadRef).
     14    3. Let iterator be ? GetIterator(spreadObj).
     15    4. Repeat
     16       a. Let next be ? IteratorStep(iterator).
     17       b. If next is false, return nextIndex.
     18       c. Let nextValue be ? IteratorValue(next).
     19       d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)),
     20          nextValue).
     21       e. Assert: status is true.
     22       f. Let nextIndex be nextIndex + 1.
     23 
     24    12.3.6.1 Runtime Semantics: ArgumentListEvaluation
     25 
     26    ArgumentList : ... AssignmentExpression
     27 
     28    1. Let list be an empty List.
     29    2. Let spreadRef be the result of evaluating AssignmentExpression.
     30    3. Let spreadObj be GetValue(spreadRef).
     31    4. Let iterator be GetIterator(spreadObj).
     32    5. ReturnIfAbrupt(iterator).
     33    6. Repeat
     34       a. Let next be IteratorStep(iterator).
     35       b. ReturnIfAbrupt(next).
     36 
     37    7.4.5 IteratorStep ( iterator )
     38 
     39    1. Let result be IteratorNext(iterator).
     40    2. ReturnIfAbrupt(result).
     41 
     42    7.4.2 IteratorNext ( iterator, value )
     43 
     44    1. If value was not passed, then
     45       a. Let result be Invoke(iterator, "next", « »).
     46    [...]
     47    3. ReturnIfAbrupt(result).
     48 ---*/
     49 var iter = {};
     50 iter[Symbol.iterator] = function() {
     51  return {
     52    next: function() {
     53      throw new Test262Error();
     54    }
     55  };
     56 };
     57 
     58 assert.throws(Test262Error, function() {
     59  [...iter];
     60 });
     61 
     62 reportCompare(0, 0);