tor-browser

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

scope-var-close.js (939B)


      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-with-statement-runtime-semantics-evaluation
      5 es6id: 13.11.7
      6 description: Removal of variable environment
      7 info: |
      8    3. Let oldEnv be the running execution context's LexicalEnvironment.
      9    4. Let newEnv be NewObjectEnvironment(obj, oldEnv).
     10    5. Set the withEnvironment flag of newEnv's EnvironmentRecord to true.
     11    6. Set the running execution context's LexicalEnvironment to newEnv.
     12    7. Let C be the result of evaluating Statement.
     13    8. Set the running execution context's LexicalEnvironment to oldEnv.
     14 flags: [noStrict]
     15 ---*/
     16 
     17 var probeBody;
     18 
     19 with ({ x: 0 })
     20  var x = 1, _ = probeBody = function() { return x; };
     21 
     22 var x = 2;
     23 
     24 assert.sameValue(probeBody(), 1, 'reference from statement body');
     25 assert.sameValue(x, 2, 'reference following statement');
     26 
     27 reportCompare(0, 0);