head-let-destructuring.js (784B)
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-for-in-and-for-of-statements 5 es6id: 13.7.5 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] of 15 AssignmentExpression[+In, ?Yield] ) Statement[?Yield, ?Return] 16 17 for ( ForDeclaration[?Yield] of AssignmentExpression[+In, ?Yield] ) 18 Statement[?Yield, ?Return] 19 ---*/ 20 21 var value; 22 23 for ( let[x] of [[34]] ) { 24 value = x; 25 } 26 27 assert.sameValue(typeof x, 'undefined', 'binding is block-scoped'); 28 assert.sameValue(value, 34); 29 30 reportCompare(0, 0);