static-init-expr-this.js (629B)
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-operations-on-objects 5 description: The "this" value within a static initialization block is the class 6 info: | 7 2.1.1 EvaluateStaticBlock ( receiver , blockRecord ) 8 9 1. Assert: Type(receiver) is Object. 10 2. Assert: blockRecord is a ClassStaticBlockDefinition Record. 11 3. Perform ? Call(blockRecord.[[Body]], receiver). 12 features: [class-static-block] 13 ---*/ 14 15 var value; 16 17 class C { 18 static { 19 value = this; 20 } 21 } 22 23 assert.sameValue(value, C); 24 25 reportCompare(0, 0);