scope-lex-open.js (897B)
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-block-runtime-semantics-evaluation 5 description: Creation of new lexical environment for BlockStatement 6 info: | 7 1. Let oldEnv be the running execution context's LexicalEnvironment. 8 2. Let blockEnv be NewDeclarativeEnvironment(oldEnv). 9 3. Perform BlockDeclarationInstantiation(StatementList, blockEnv). 10 4. Set the running execution context's LexicalEnvironment to blockEnv. 11 5. Let blockValue be the result of evaluating StatementList. 12 [...] 13 features: [let] 14 ---*/ 15 16 let x = 'outside'; 17 var probeBefore = function() { return x; }; 18 var probeInside; 19 20 { 21 let x = 'inside'; 22 probeInside = function() { return x; }; 23 } 24 25 assert.sameValue(probeBefore(), 'outside'); 26 assert.sameValue(probeInside(), 'inside'); 27 28 reportCompare(0, 0);