lex-env-no-init-let.js (854B)
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-performeval 5 description: > 6 Direct eval code creates `let` bindings prior to evaluation but does not 7 initialize them. 8 info: | 9 [...] 10 14. For each element d in lexDeclarations do 11 a. NOTE Lexically declared names are only instantiated here but not 12 initialized. 13 b. For each element dn of the BoundNames of d do 14 i. If IsConstantDeclaration of d is true, then 15 1. Perform ? lexEnvRec.CreateImmutableBinding(dn, true). 16 ii. Else, 17 2. Perform ? lexEnvRec.CreateMutableBinding(dn, false). 18 [...] 19 features: [let] 20 ---*/ 21 22 assert.throws(ReferenceError, function() { 23 eval('typeof x; let x;'); 24 }); 25 26 reportCompare(0, 0);