class-name-static-initializer-default-export.js (750B)
1 // |reftest| module 2 // Copyright 2019 André Bargull. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-runtime-semantics-classdefinitionevaluation 7 description: > 8 The class-name is present when executing static field initializers of default-exported classes. 9 info: | 10 14.6.13 Runtime Semantics: ClassDefinitionEvaluation 11 12 [...] 13 17. Perform MakeClassConstructor(F). 14 18. If className is not undefined, then 15 a. Perform SetFunctionName(F, className). 16 [...] 17 18 flags: [module] 19 features: [class-static-fields-public] 20 ---*/ 21 22 var className; 23 24 export default class { 25 static f = (className = this.name); 26 } 27 28 assert.sameValue(className, "default"); 29 30 reportCompare(0, 0);