Debian Codegraph @

js/src/tests/test262/language/module-code/instn-star-props-circular.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 Circular "star" imports do not trigger infinite recursion during name
7 enumeration.
8 esid: sec-moduledeclarationinstantiation
9 info: |
10 [...]
11 12. For each ImportEntry Record in in module.[[ImportEntries]], do
12 a. Let importedModule be ? HostResolveImportedModule(module,
13 in.[[ModuleRequest]]).
14 b. If in.[[ImportName]] is "*", then
15 i. Let namespace be ? GetModuleNamespace(importedModule).
16 [...]
17
18 15.2.1.18 Runtime Semantics: GetModuleNamespace
19
20 [...]
21 3. If namespace is undefined, then
22 a. Let exportedNames be ? module.GetExportedNames(« »).
23 [...]
24
25 15.2.1.16.2 GetExportedNames
26
27 1. Let module be this Source Text Module Record.
28 2. If exportStarSet contains module, then
29 a. Assert: We've reached the starting point of an import * circularity.
30 b. Return a new empty List.
31 flags: [module]
32 ---*/
33
34 import * as a from './instn-star-props-circular-a_FIXTURE.js';
35 import * as b from './instn-star-props-circular-b_FIXTURE.js';
36
37 assert('fromA' in a, 'entry for binding from "a" in namespace of module A');
38 assert('fromB' in a, 'entry for binding from "b" in namespace of module A');
39
40 assert('fromA' in b, 'entry for binding from "a" in namespace of module B');
41 assert('fromB' in b, 'entry for binding from "b" in namespace of module B');
42
43 reportCompare(0, 0);