tor-browser

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

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


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