static-init-scope-private.js (802B)
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: Shares environment record for privately-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-fields-private, class-static-block] 13 ---*/ 14 15 var probe; 16 17 class C { 18 static #test262 = 'private'; 19 20 static { 21 probe = C.#test262; 22 } 23 } 24 25 assert.sameValue(probe, 'private'); 26 27 reportCompare(0, 0);