Debian Codegraph @

js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-name-meth.js

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