Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / language / module-code / eval-export-dflt-expr-cls-name-meth.js
blob8af5e458c9f72c3741c5c09de0f73206efad925f
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 AssignmentExpression (which can be recognized as an "anonymous"
7     class declaration with a static `name` method) is correctly initialized
8     upon evaluation
9 esid: sec-moduleevaluation
10 info: |
11     [...]
12     16. Let result be the result of evaluating module.[[ECMAScriptCode]].
13     [...]
15     15.2.3.11 Runtime Semantics: Evaluation
17     ExportDeclaration : export default ClassDeclaration
19     [...]
20     3. Let className be the sole element of BoundNames of ClassDeclaration.
21     4. If className is "*default*", then
22        a. Let hasNameProperty be ? HasOwnProperty(value, "name").
23        b. If hasNameProperty is false, perform SetFunctionName(value,
24           "default").
25        c. Let env be the running execution context's LexicalEnvironment.
26        d. Perform ? InitializeBoundName("*default*", value, env).
27     5. Return NormalCompletion(empty).
28 flags: [module]
29 ---*/
31 export default (class { static name() { return 'name method'; } });
32 import C from './eval-export-dflt-expr-cls-name-meth.js';
34 assert.sameValue(
35   C.name(), 'name method', '`name` property is not over-written'
38 reportCompare(0, 0);