Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / language / module-code / instn-named-bndng-cls.js
blob02970467074e9a0aecf887126196cb44f167c46a
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: Imported binding reflects state of exported `class` binding
6 esid: sec-moduledeclarationinstantiation
7 info: |
8     [...]
9     12. For each ImportEntry Record in in module.[[ImportEntries]], do
10         a. Let importedModule be ? HostResolveImportedModule(module,
11            in.[[ModuleRequest]]).
12         b. If in.[[ImportName]] is "*", then
13            [...]
14         c. Else,
15            i. Let resolution be ?
16               importedModule.ResolveExport(in.[[ImportName]], « », « »).
17            ii. If resolution is null or resolution is "ambiguous", throw a
18                SyntaxError exception.
19            iii. Call envRec.CreateImportBinding(in.[[LocalName]],
20                 resolution.[[Module]], resolution.[[BindingName]]).
21     [...]
22     16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
23     17. For each element d in lexDeclarations do
24         a. For each element dn of the BoundNames of d do
25            i, If IsConstantDeclaration of d is true, then
26               [...]
27            ii. Else,
28                1. Perform ! envRec.CreateMutableBinding(dn, false).
29            iii. If d is a GeneratorDeclaration production or a
30                 FunctionDeclaration production, then
31                 [...]
33     8.1.1.5.5 CreateImportBinding
35     [...]
36     5. Create an immutable indirect binding in envRec for N that references M
37        and N2 as its target binding and record that the binding is initialized.
38     6. Return NormalCompletion(empty).
39 flags: [module]
40 ---*/
42 assert.throws(ReferenceError, function() {
43   typeof D;
44 }, 'binding is created but not initialized');
46 import { C as D } from './instn-named-bndng-cls.js';
47 export class C {}
49 reportCompare(0, 0);