| 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 |
i. Let namespace be ? GetModuleNamespace(importedModule). |
| 16 |
ii. Perform ! envRec.CreateImmutableBinding(in.[[LocalName]], true). |
| 17 |
iii. Call envRec.InitializeBinding(in.[[LocalName]], namespace). |
| 18 |
[...] |
| 19 |
|
| 20 |
15.2.1.16.3 ResolveExport( exportName, resolveSet ) |
| 21 |
|
| 22 |
[...] |
| 23 |
3. Append the Record {[[Module]]: module, [[ExportName]]: exportName} to resolveSet. |
| 24 |
4. For each ExportEntry Record e in module.[[LocalExportEntries]], do |
| 25 |
a. If SameValue(exportName, e.[[ExportName]]) is true, then |
| 26 |
i. Assert: module provides the direct binding for this export. |
| 27 |
ii. Return Record{[[Module]]: module, [[BindingName]]: e.[[LocalName]]}. |
| 28 |
5. For each ExportEntry Record e in module.[[IndirectExportEntries]], do |
| 29 |
a. If SameValue(exportName, e.[[ExportName]]) is true, then |
| 30 |
i. Assert: module imports a specific binding for this export. |
| 31 |
ii. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]). |
| 32 |
iii. Return ? importedModule.ResolveExport(e.[[ImportName]], resolveSet). |
| 33 |
[...] |
| 34 |
8. For each ExportEntry Record e in module.[[StarExportEntries]], do |
| 35 |
a. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]). |
| 36 |
b. Let resolution be ? importedModule.ResolveExport(exportName, resolveSet). |
| 37 |
[...] |
| 38 |
d. If resolution is not null, then |
| 39 |
i. If starResolution is null, let starResolution be resolution. |
| 40 |
[...] |
| 41 |
9. Return starResolution. |
| 42 |
flags: [module] |
| 43 |
---*/ |
| 44 |
|
| 45 |
import * as ns from './instn-star-star-cycle-2_FIXTURE.js'; |
| 46 |
|
| 47 |
assert.sameValue(ns.x, 45); |
| 48 |
assert.sameValue(ns.y, 45); |
| 49 |
|
| 50 |
reportCompare(0, 0); |