tor-browser

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

static-init-scope-lex-open.js (986B)


      1 // Copyright (C) 2021 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-runtime-semantics-classstaticblockdefinitionevaluation
      5 description: Creation of new environment record for lexically-scoped bindings
      6 info: |
      7  ClassStaticBlock : static { ClassStaticBlockBody }
      8 
      9    1. Let lex be the running execution context's LexicalEnvironment.
     10    2. Let privateScope be the running execution context's PrivateEnvironment.
     11    3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope).
     12 features: [class-static-block]
     13 ---*/
     14 
     15 let test262 = 'outer scope';
     16 let probe1, probe2;
     17 
     18 class C {
     19  static {
     20    let test262 = 'first block';
     21    probe1 = test262;
     22  }
     23  static {
     24    let test262 = 'second block';
     25    probe2 = test262;
     26  }
     27 }
     28 
     29 assert.sameValue(test262, 'outer scope');
     30 assert.sameValue(probe1, 'first block');
     31 assert.sameValue(probe2, 'second block');
     32 
     33 reportCompare(0, 0);