ary-ptrn-rest-id.js (1142B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-binding/ary-ptrn-rest-id.case 3 // - src/dstr-binding/default/var-stmt.template 4 /*--- 5 description: Lone rest element (`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 BindingRestElement : ... BindingIdentifier 20 [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat 21 [...] 22 f. Let status be CreateDataProperty(A, ToString (n), nextValue). 23 [...] 24 ---*/ 25 var values = [1, 2, 3]; 26 27 var [...x] = values; 28 29 assert(Array.isArray(x)); 30 assert.sameValue(x.length, 3); 31 assert.sameValue(x[0], 1); 32 assert.sameValue(x[1], 2); 33 assert.sameValue(x[2], 3); 34 assert.notSameValue(x, values); 35 36 reportCompare(0, 0);