Debian Codegraph @

js/src/tests/test262/language/module-code/instn-star-equality.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: A single namespace is created for each module
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 i. Let namespace be ? GetModuleNamespace(importedModule).
14 ii. Perform ! envRec.CreateImmutableBinding(in.[[LocalName]], true).
15 iii. Call envRec.InitializeBinding(in.[[LocalName]], namespace).
16 [...]
17
18 15.2.1.18 Runtime Semantics: GetModuleNamespace
19
20 1. Assert: module is an instance of a concrete subclass of Module Record.
21 2. Let namespace be module.[[Namespace]].
22 3. If namespace is undefined, then
23 [...]
24 4. Return namespace.
25 flags: [module]
26 ---*/
27
28 import * as self1 from './instn-star-equality.js';
29 import * as self2 from './instn-star-equality.js';
30 import * as other1 from './instn-star-equality-other_FIXTURE.js';
31 import * as self3 from './instn-star-equality.js';
32 import * as other2 from './instn-star-equality-other_FIXTURE.js';
33 import { testNs } from './instn-star-equality-other_FIXTURE.js';
34
35 assert.sameValue(
36 self1, self2, 'Local namespace objects from consecutive declarations'
37 );
38 assert.sameValue(
39 self1, self3, 'Local namespace objects from non-consective declarations'
40 );
41 assert.sameValue(other1, other2, 'External namespace objects');
42 assert.sameValue(self1, testNs, 'Re-exported namespace objects');
43
44 assert.notSameValue(self1, other1);
45
46 reportCompare(0, 0);