const-ary-ptrn-rest-id-direct.js (1850B)
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/for-const.template 4 /*--- 5 description: Lone rest element (direct binding) (for statement) 6 esid: sec-for-statement-runtime-semantics-labelledevaluation 7 features: [destructuring-binding] 8 flags: [generated] 9 includes: [compareArray.js] 10 info: | 11 IterationStatement : 12 for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement 13 14 [...] 15 7. Let forDcl be the result of evaluating LexicalDeclaration. 16 [...] 17 18 LexicalDeclaration : LetOrConst BindingList ; 19 20 1. Let next be the result of evaluating BindingList. 21 2. ReturnIfAbrupt(next). 22 3. Return NormalCompletion(empty). 23 24 BindingList : BindingList , LexicalBinding 25 26 1. Let next be the result of evaluating BindingList. 27 2. ReturnIfAbrupt(next). 28 3. Return the result of evaluating LexicalBinding. 29 30 LexicalBinding : BindingPattern Initializer 31 32 1. Let rhs be the result of evaluating Initializer. 33 2. Let value be GetValue(rhs). 34 3. ReturnIfAbrupt(value). 35 4. Let env be the running execution context’s LexicalEnvironment. 36 5. Return the result of performing BindingInitialization for BindingPattern 37 using value and env as the arguments. 38 39 Runtime Semantics: IteratorBindingInitialization 40 41 BindingRestElement : ... BindingIdentifier 42 43 [...] 44 2. Let A be ! ArrayCreate(0). 45 3. Let n be 0. 46 4. Repeat, 47 [...] 48 f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). 49 g. Set n to n + 1. 50 51 ---*/ 52 53 var iterCount = 0; 54 55 for (const [...x] = [1]; iterCount < 1; ) { 56 assert(Array.isArray(x)); 57 assert.compareArray(x, [1]); 58 59 iterCount += 1; 60 } 61 62 assert.sameValue(iterCount, 1, 'Iteration occurred as expected'); 63 64 reportCompare(0, 0);