ary-ptrn-rest-id-direct.js (1090B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-binding/ary-ptrn-rest-id-direct.case 3 // - src/dstr-binding/default/var-stmt.template 4 /*--- 5 description: Lone rest element (direct binding) (`var` statement) 6 esid: sec-variable-statement-runtime-semantics-evaluation 7 features: [destructuring-binding] 8 flags: [generated] 9 includes: [compareArray.js] 10 info: | 11 VariableDeclaration : BindingPattern Initializer 12 13 1. Let rhs be the result of evaluating Initializer. 14 2. Let rval be GetValue(rhs). 15 3. ReturnIfAbrupt(rval). 16 4. Return the result of performing BindingInitialization for 17 BindingPattern passing rval and undefined as arguments. 18 19 Runtime Semantics: IteratorBindingInitialization 20 21 BindingRestElement : ... BindingIdentifier 22 23 [...] 24 2. Let A be ! ArrayCreate(0). 25 3. Let n be 0. 26 4. Repeat, 27 [...] 28 f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). 29 g. Set n to n + 1. 30 31 ---*/ 32 33 var [...x] = [1]; 34 35 assert(Array.isArray(x)); 36 assert.compareArray(x, [1]); 37 38 reportCompare(0, 0);