tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

lex-env-distinct-let.js (831B)


      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 a new declarative environment for lexically-scoped
      7    declarations (let)
      8 info: |
      9    [...]
     10    9. If direct is true, then
     11       a. Let lexEnv be NewDeclarativeEnvironment(ctx's LexicalEnvironment).
     12    [...]
     13 features: [let]
     14 ---*/
     15 
     16 let outside = 23;
     17 
     18 eval('let outside;');
     19 eval('"use strict"; let outside;');
     20 
     21 eval('let xNonStrict = 3;');
     22 
     23 assert.sameValue(typeof xNonStrict, 'undefined');
     24 assert.throws(ReferenceError, function() {
     25  xNonStrict;
     26 });
     27 
     28 eval('"use strict"; let xStrict = 3;');
     29 
     30 assert.sameValue(typeof xStrict, 'undefined');
     31 assert.throws(ReferenceError, function() {
     32  xStrict;
     33 });
     34 
     35 reportCompare(0, 0);