tor-browser

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

scope-lex-close.js (966B)


      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-ecmascript-function-objects-call-thisargument-argumentslist
      5 description: >
      6    Removal of lexical environment for the function parameters and body
      7 info: |
      8    [...]
      9    3. Let callerContext be the running execution context.
     10    [...]
     11    8. Remove calleeContext from the execution context stack and restore
     12       callerContext as the running execution context.
     13    [...]
     14 features: [let]
     15 ---*/
     16 
     17 var probe;
     18 
     19 // This test intentionally elides parameter expressions because their presence
     20 // triggers the creation of an additional LexicalEnvironment dedicated to the
     21 // function body (see sec-functiondeclarationinstantiation)
     22 (function() {
     23  let x = 'inside';
     24  probe = function() { return x; };
     25 }());
     26 
     27 var x = 'outside';
     28 
     29 assert.sameValue(probe(), 'inside');
     30 assert.sameValue(x, 'outside');
     31 
     32 reportCompare(0, 0);