eval-export-dflt-cls-name-meth.js (1245B)
1 // |reftest| module 2 // Copyright (C) 2016 the V8 project authors. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 /*--- 5 description: > 6 Default "anonymous" class declaration containing a static `name` method is 7 correctly initialized upon evaluation 8 esid: sec-moduleevaluation 9 info: | 10 [...] 11 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. 12 [...] 13 14 15.2.3.11 Runtime Semantics: Evaluation 15 16 ExportDeclaration : export default ClassDeclaration 17 18 [...] 19 3. Let className be the sole element of BoundNames of ClassDeclaration. 20 4. If className is "*default*", then 21 a. Let hasNameProperty be ? HasOwnProperty(value, "name"). 22 b. If hasNameProperty is false, perform SetFunctionName(value, 23 "default"). 24 c. Let env be the running execution context's LexicalEnvironment. 25 d. Perform ? InitializeBoundName("*default*", value, env). 26 5. Return NormalCompletion(empty). 27 flags: [module] 28 ---*/ 29 30 export default class { static name() { return 'name method'; } } 31 import C from './eval-export-dflt-cls-name-meth.js'; 32 33 assert.sameValue( 34 C.name(), 'name method', '`name` property is not over-written' 35 ); 36 37 reportCompare(0, 0);