head-let-destructuring.js (841B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-iteration-statements 5 es6id: 13.7 6 description: > 7 The token sequence `let [`is interpreted as the beginning of a destructuring 8 binding pattern 9 info: | 10 Syntax 11 12 IterationStatement[Yield, Return]: 13 14 for ( [lookahead ∉ { let [ } ] Expression[~In, ?Yield]opt ; 15 Expression[+In, ?Yield]opt ; Expression[+In, ?Yield]opt ) 16 Statement[?Yield, ?Return] 17 18 for ( LexicalDeclaration[~In, ?Yield] Expression[+In, ?Yield]opt ; 19 Expression[+In, ?Yield]opt) Statement[?Yield, ?Return] 20 ---*/ 21 22 var value; 23 24 for ( let[x] = [23]; ; ) { 25 value = x; 26 break; 27 } 28 29 assert.sameValue(typeof x, 'undefined', 'binding is block-scoped'); 30 assert.sameValue(value, 23); 31 32 reportCompare(0, 0);