Debian Codegraph @

js/src/tests/test262/language/module-code/instn-named-star-cycle.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 Modules can be visited more than once when resolving bindings through
7 "star" exports as long as the exportName is different each time.
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 [...]
16 c. Else,
17 i. Let resolution be ?
18 importedModule.ResolveExport(in.[[ImportName]], « », « »).
19 [...]
20 iii. Call envRec.CreateImportBinding(in.[[LocalName]],
21 resolution.[[Module]], resolution.[[BindingName]]).
22 [...]
23
24 15.2.1.16.3 ResolveExport( exportName, resolveSet )
25
26 [...]
27 3. Append the Record {[[Module]]: module, [[ExportName]]: exportName} to resolveSet.
28 4. For each ExportEntry Record e in module.[[LocalExportEntries]], do
29 a. If SameValue(exportName, e.[[ExportName]]) is true, then
30 i. Assert: module provides the direct binding for this export.
31 ii. Return Record{[[Module]]: module, [[BindingName]]: e.[[LocalName]]}.
32 5. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
33 a. If SameValue(exportName, e.[[ExportName]]) is true, then
34 i. Assert: module imports a specific binding for this export.
35 ii. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]).
36 iii. Return ? importedModule.ResolveExport(e.[[ImportName]], resolveSet).
37 [...]
38 8. For each ExportEntry Record e in module.[[StarExportEntries]], do
39 a. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]).
40 b. Let resolution be ? importedModule.ResolveExport(exportName, resolveSet).
41 [...]
42 d. If resolution is not null, then
43 i. If starResolution is null, let starResolution be resolution.
44 [...]
45 9. Return starResolution.
46 flags: [module]
47 ---*/
48
49 import { x } from './instn-named-star-cycle-2_FIXTURE.js';
50
51 assert.sameValue(x, 45);
52
53 reportCompare(0, 0);