tor-browser

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

ary-ptrn-rest-id-elision.js (1421B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-binding/ary-ptrn-rest-id-elision.case
      3 // - src/dstr-binding/default/var-stmt.template
      4 /*---
      5 description: Rest element following elision elements (`var` statement)
      6 esid: sec-variable-statement-runtime-semantics-evaluation
      7 features: [destructuring-binding]
      8 flags: [generated]
      9 info: |
     10    VariableDeclaration : BindingPattern Initializer
     11 
     12    1. Let rhs be the result of evaluating Initializer.
     13    2. Let rval be GetValue(rhs).
     14    3. ReturnIfAbrupt(rval).
     15    4. Return the result of performing BindingInitialization for
     16       BindingPattern passing rval and undefined as arguments.
     17 
     18    13.3.3.6 Runtime Semantics: IteratorBindingInitialization
     19    ArrayBindingPattern : [ Elisionopt BindingRestElement ]
     20    1. If Elision is present, then
     21       a. Let status be the result of performing
     22          IteratorDestructuringAssignmentEvaluation of Elision with
     23          iteratorRecord as the argument.
     24       b. ReturnIfAbrupt(status).
     25    2. Return the result of performing IteratorBindingInitialization for
     26       BindingRestElement with iteratorRecord and environment as arguments.
     27 ---*/
     28 var values = [1, 2, 3, 4, 5];
     29 
     30 var [ , , ...x] = values;
     31 
     32 assert(Array.isArray(x));
     33 assert.sameValue(x.length, 3);
     34 assert.sameValue(x[0], 3);
     35 assert.sameValue(x[1], 4);
     36 assert.sameValue(x[2], 5);
     37 assert.notSameValue(x, values);
     38 
     39 reportCompare(0, 0);