head-let-destructuring.js (805B)
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 [ } ] LeftHandSideExpression[?Yield] in 15 Expression[+In, ?Yield] ) Statement[?Yield, ?Return] 16 17 for ( ForDeclaration[?Yield] in Expression[+In, ?Yield] ) 18 Statement[?Yield, ?Return] 19 ---*/ 20 21 var obj = Object.create(null); 22 var value; 23 24 obj.key = 1; 25 26 for ( let[x] in obj ) { 27 value = x; 28 } 29 30 assert.sameValue(typeof x, 'undefined', 'binding is block-scoped'); 31 assert.sameValue(value, 'k'); 32 33 reportCompare(0, 0);