tor-browser

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

scope-var-open.js (1091B)


      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: Creation of new 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 flags: [noStrict]
     14 ---*/
     15 
     16 var x = 0;
     17 var objectRecord = { x: 2 };
     18 var probeBefore = function() { return x; };
     19 var probeExpr, probeBody;
     20 
     21 with (eval('var x = 1;'), probeExpr = function() { return x; }, objectRecord)
     22  var x = 3, _ = probeBody = function() { return x; };
     23 
     24 assert.sameValue(probeBefore(), 1, 'reference preceding statement');
     25 assert.sameValue(probeExpr(), 1, 'reference from expression');
     26 assert.sameValue(probeBody(), 3, 'reference from statement body');
     27 
     28 reportCompare(0, 0);