Debian Codegraph @

js/src/tests/test262/language/module-code/eval-export-dflt-cls-named.js

raw
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 "named" class declaration is correctly initialized upon
7 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 cName { valueOf() { return 45; } }
31 import C from './eval-export-dflt-cls-named.js';
32
33 assert.sameValue(new C().valueOf(), 45, 'binding initialized');
34 assert.sameValue(C.name, 'cName', 'correct name is assigned');
35
36 reportCompare(0, 0);