tor-browser

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

spread-sngl-expr.js (1839B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/spread/sngl-expr.case
      3 // - src/spread/default/array.template
      4 /*---
      5 description: Spread operator applied to AssignmentExpression as only element (Array initializer)
      6 esid: sec-runtime-semantics-arrayaccumulation
      7 flags: [generated]
      8 info: |
      9    SpreadElement : ...AssignmentExpression
     10 
     11    1. Let spreadRef be the result of evaluating AssignmentExpression.
     12    2. Let spreadObj be ? GetValue(spreadRef).
     13    3. Let iterator be ? GetIterator(spreadObj).
     14    4. Repeat
     15       a. Let next be ? IteratorStep(iterator).
     16       b. If next is false, return nextIndex.
     17       c. Let nextValue be ? IteratorValue(next).
     18       d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)),
     19          nextValue).
     20       e. Assert: status is true.
     21       f. Let nextIndex be nextIndex + 1.
     22 
     23    12.3.6.1 Runtime Semantics: ArgumentListEvaluation
     24 
     25    ArgumentList : ... AssignmentExpression
     26 
     27    1. Let list be an empty List.
     28    2. Let spreadRef be the result of evaluating AssignmentExpression.
     29    3. Let spreadObj be GetValue(spreadRef).
     30    4. Let iterator be GetIterator(spreadObj).
     31    5. ReturnIfAbrupt(iterator).
     32    6. Repeat
     33       a. Let next be IteratorStep(iterator).
     34       b. ReturnIfAbrupt(next).
     35       c. If next is false, return list.
     36       d. Let nextArg be IteratorValue(next).
     37       e. ReturnIfAbrupt(nextArg).
     38       f. Append nextArg as the last element of list.
     39 ---*/
     40 var source = [2, 3, 4];
     41 var target;
     42 
     43 var callCount = 0;
     44 
     45 (function() {
     46  assert.sameValue(arguments.length, 3);
     47  assert.sameValue(arguments[0], 2);
     48  assert.sameValue(arguments[1], 3);
     49  assert.sameValue(arguments[2], 4);
     50  assert.sameValue(target, source);
     51  callCount += 1;
     52 }.apply(null, [...target = source]));
     53 
     54 assert.sameValue(callCount, 1);
     55 
     56 reportCompare(0, 0);