| browser.js |
|
0 |
- |
| error-export-from-named-1_FIXTURE.js |
|
153 |
- |
| error-export-from-named-2_FIXTURE.js |
|
153 |
- |
| error-export-from-named-as.js |
---
description: IndirectExportEntries validation - ambiguous imported bindings
esid: sec-moduledeclarationinstantiation
info: |
[...]
9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
b. If resolution is null or resolution is "ambiguous", throw a
SyntaxError exception.
[...]
15.2.1.16.3 ResolveExport
[...]
9. Let starResolution be null.
10. For each ExportEntry Record e in module.[[StarExportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName,
resolveSet, exportStarSet).
c. If resolution is "ambiguous", return "ambiguous".
d. If resolution is not null, then
i. If starResolution is null, let starResolution be resolution.
ii. Else,
1. Assert: there is more than one * import that includes the
requested name.
2. If resolution.[[Module]] and starResolution.[[Module]] are
not the same Module Record or
SameValue(resolution.[[BindingName]],
starResolution.[[BindingName]]) is false, return "ambiguous".
negative:
phase: resolution
type: SyntaxError
flags: [module]
--- |
1681 |
- |
| error-export-from-named.js |
---
description: IndirectExportEntries validation - ambiguous imported bindings
esid: sec-moduledeclarationinstantiation
info: |
[...]
9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
b. If resolution is null or resolution is "ambiguous", throw a
SyntaxError exception.
[...]
15.2.1.16.3 ResolveExport
[...]
9. Let starResolution be null.
10. For each ExportEntry Record e in module.[[StarExportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName,
resolveSet, exportStarSet).
c. If resolution is "ambiguous", return "ambiguous".
d. If resolution is not null, then
i. If starResolution is null, let starResolution be resolution.
ii. Else,
1. Assert: there is more than one * import that includes the
requested name.
2. If resolution.[[Module]] and starResolution.[[Module]] are
not the same Module Record or
SameValue(resolution.[[BindingName]],
starResolution.[[BindingName]]) is false, return "ambiguous".
negative:
phase: resolution
type: SyntaxError
flags: [module]
--- |
1676 |
- |
| error-export-from-named_FIXTURE.js |
|
251 |
- |
| error-import-named-1_FIXTURE.js |
|
153 |
- |
| error-import-named-2_FIXTURE.js |
|
153 |
- |
| error-import-named-as.js |
---
description: Named import binding - resolution failure (ambiguous name)
esid: sec-moduledeclarationinstantiation
info: |
[...]
12. For each ImportEntry Record in in module.[[ImportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
in.[[ModuleRequest]]).
b. If in.[[ImportName]] is "*", then
[...]
c. Else,
i. Let resolution be ?
importedModule.ResolveExport(in.[[ImportName]], « », « »).
ii. If resolution is null or resolution is "ambiguous", throw a
SyntaxError exception.
15.2.1.16.3 ResolveExport
[...]
9. Let starResolution be null.
10. For each ExportEntry Record e in module.[[StarExportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName,
resolveSet, exportStarSet).
c. If resolution is "ambiguous", return "ambiguous".
d. If resolution is not null, then
i. If starResolution is null, let starResolution be resolution.
ii. Else,
1. Assert: there is more than one * import that includes the
requested name.
2. If resolution.[[Module]] and starResolution.[[Module]] are
not the same Module Record or
SameValue(resolution.[[BindingName]],
starResolution.[[BindingName]]) is false, return "ambiguous".
negative:
phase: resolution
type: SyntaxError
flags: [module]
--- |
1875 |
- |
| error-import-named.js |
---
description: Named import binding - resolution failure (ambiguous name)
esid: sec-moduledeclarationinstantiation
info: |
[...]
12. For each ImportEntry Record in in module.[[ImportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
in.[[ModuleRequest]]).
b. If in.[[ImportName]] is "*", then
[...]
c. Else,
i. Let resolution be ?
importedModule.ResolveExport(in.[[ImportName]], « », « »).
ii. If resolution is null or resolution is "ambiguous", throw a
SyntaxError exception.
15.2.1.16.3 ResolveExport
[...]
9. Let starResolution be null.
10. For each ExportEntry Record e in module.[[StarExportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName,
resolveSet, exportStarSet).
c. If resolution is "ambiguous", return "ambiguous".
d. If resolution is not null, then
i. If starResolution is null, let starResolution be resolution.
ii. Else,
1. Assert: there is more than one * import that includes the
requested name.
2. If resolution.[[Module]] and starResolution.[[Module]] are
not the same Module Record or
SameValue(resolution.[[BindingName]],
starResolution.[[BindingName]]) is false, return "ambiguous".
negative:
phase: resolution
type: SyntaxError
flags: [module]
--- |
1870 |
- |
| error-import-named_FIXTURE.js |
|
241 |
- |
| import-and-export-propagates-binding.js |
---
description: A binding re-exported with `export { foo } from` and `import { foo } from; export { foo }` does not cause ambiguity.
esid: sec-source-text-module-record-initialize-environment
info: |
[...]
7. For each ImportEntry Record in of module.[[ImportEntries]], do
a. Let importedModule be GetImportedModule(module, in.[[ModuleRequest]]).
b. If in.[[ImportName]] is namespace-object, then
i. Let namespace be GetModuleNamespace(importedModule).
ii. Perform ! env.CreateImmutableBinding(in.[[LocalName]], true).
iii. Perform ! env.InitializeBinding(in.[[LocalName]], namespace).
c. Else,
i. Let resolution be importedModule.ResolveExport(in.[[ImportName]]).
ii. If resolution is either null or ambiguous, throw a SyntaxError exception.
Table 59 (Informative): Export Forms Mappings to ExportEntry Records
Export Statement Form [[ExportName]] [[ModuleRequest]] [[ImportName]] [[LocalName]]
export {x}; "x" null null "x"
export {x} from "mod"; "x" "mod" "x" null
16.2.1.7.1 ParseModule ( sourceText, realm, hostDefined )
[...]
10. For each ExportEntry Record ee of exportEntries, do
1. If ee.[[ModuleRequest]] is null, then
i. If importedBoundNames does not contain ee.[[LocalName]], then
1. Append ee to localExportEntries.
ii. Else,
1. Let ie be the element of importEntries whose [[LocalName]] is ee.[[LocalName]].
2. If ie.[[ImportName]] is namespace-object, then
a. NOTE: This is a re-export of an imported module namespace object.
b. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]], [[ImportName]]: ~all~, [[LocalName]]: *null*, [[ExportName]]: ee.[[ExportName]] } to indirectExportEntries.
3. Else,
a. NOTE: This is a re-export of a single name.
b. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]],
[[ImportName]]: ie.[[ImportName]], [[LocalName]]: null, [[ExportName]]:
ee.[[ExportName]] } to indirectExportEntries.
2. Else if ee.[[ImportName]] is all-but-default, then
[...]
3. Else,
a. Append ee to indirectExportEntries.
15.2.1.16.3 ResolveExport
[...]
6. For each ExportEntry Record e of module.[[IndirectExportEntries]], do
a. If e.[[ExportName]] is exportName, then
i. Assert: e.[[ModuleRequest]] is not null.
ii. Let importedModule be GetImportedModule(module, e.[[ModuleRequest]]).
iii. If e.[[ImportName]] is all, then
1. Assert: module does not provide the direct binding for this export.
2. Return ResolvedBinding Record { [[Module]]: importedModule, [[BindingName]]: namespace }.
[...]
9. Let starResolution be null.
10. For each ExportEntry Record e in module.[[StarExportEntries]], do
a. Let importedModule be GetImportedModule(module,
e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName,
resolveSet, exportStarSet).
c. If resolution is ~ambiguous~, return ~ambiguous~.
d. If resolution is not null, then
i. If starResolution is null, let starResolution be resolution.
ii. Else,
1. Assert: there is more than one * import that includes the
requested name.
2. If _resolution_.[[Module]] and _starResolution_.[[Module]] are
not the same Module Record, return ~ambiguous~.
3. If _resolution_.[[BindingName]] is not _starResolution_.[[BindingName]],
return ~ambiguous~.
flags: [module]
--- |
4276 |
- |
| import-and-export-propagates-binding_export-from_FIXTURE.js |
|
201 |
- |
| import-and-export-propagates-binding_FIXTURE.js |
|
150 |
- |
| import-and-export-propagates-binding_import-and-export_FIXTURE.js |
|
217 |
- |
| namespace-empty-module_FIXTURE.js |
|
127 |
- |
| namespace-export-star-as-from-1_FIXTURE.js |
|
188 |
- |
| namespace-export-star-as-from-2_FIXTURE.js |
|
188 |
- |
| namespace-import-source-and-export-1_FIXTURE.js |
|
186 |
- |
| namespace-import-source-and-export-2_FIXTURE.js |
|
186 |
- |
| namespace-import-source-and-export-reexport_FIXTURE.js |
|
262 |
- |
| namespace-import-star-as-and-export-1_FIXTURE.js |
|
204 |
- |
| namespace-import-star-as-and-export-2_FIXTURE.js |
|
204 |
- |
| namespace-unambiguous-if-export-star-as-from-and-import-star-as-and-export.js |
---
description: Exporting the same namespace object twice with `export * as foo` and `import * as foo; export { foo }` produces an unambiguous binding
esid: sec-source-text-module-record-initialize-environment
info: |
[...]
7. For each ImportEntry Record in of module.[[ImportEntries]], do
a. Let importedModule be GetImportedModule(module, in.[[ModuleRequest]]).
b. If in.[[ImportName]] is namespace-object, then
i. Let namespace be GetModuleNamespace(importedModule).
ii. Perform ! env.CreateImmutableBinding(in.[[LocalName]], true).
iii. Perform ! env.InitializeBinding(in.[[LocalName]], namespace).
c. Else,
i. Let resolution be importedModule.ResolveExport(in.[[ImportName]]).
ii. If resolution is either null or ambiguous, throw a SyntaxError exception.
Table 59 (Informative): Export Forms Mappings to ExportEntry Records
Export Statement Form [[ExportName]] [[ModuleRequest]] [[ImportName]] [[LocalName]]
export * as ns from "mod"; "ns" "mod" all null
16.2.1.7.1 ParseModule ( sourceText, realm, hostDefined )
[...]
10. For each ExportEntry Record ee of exportEntries, do
1. If ee.[[ModuleRequest]] is null, then
i. If importedBoundNames does not contain ee.[[LocalName]], then
1. Append ee to localExportEntries.
ii. Else,
1. Let ie be the element of importEntries whose [[LocalName]] is ee.[[LocalName]].
2. If ie.[[ImportName]] is namespace-object, then
a. NOTE: This is a re-export of an imported module namespace object.
b. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]], [[ImportName]]: ~all~, [[LocalName]]: *null*, [[ExportName]]: ee.[[ExportName]] } to indirectExportEntries.
3. Else,
a. NOTE: This is a re-export of a single name.
b. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]],
[[ImportName]]: ie.[[ImportName]], [[LocalName]]: null, [[ExportName]]:
ee.[[ExportName]] } to indirectExportEntries.
2. Else if ee.[[ImportName]] is all-but-default, then
[...]
3. Else,
a. Append ee to indirectExportEntries.
15.2.1.16.3 ResolveExport
[...]
6. For each ExportEntry Record e of module.[[IndirectExportEntries]], do
a. If e.[[ExportName]] is exportName, then
i. Assert: e.[[ModuleRequest]] is not null.
ii. Let importedModule be GetImportedModule(module, e.[[ModuleRequest]]).
iii. If e.[[ImportName]] is all, then
1. Assert: module does not provide the direct binding for this export.
2. Return ResolvedBinding Record { [[Module]]: importedModule, [[BindingName]]: namespace }.
[...]
9. Let starResolution be null.
10. For each ExportEntry Record e in module.[[StarExportEntries]], do
a. Let importedModule be GetImportedModule(module,
e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName,
resolveSet, exportStarSet).
c. If resolution is ~ambiguous~, return ~ambiguous~.
d. If resolution is not null, then
i. If starResolution is null, let starResolution be resolution.
ii. Else,
1. Assert: there is more than one * import that includes the
requested name.
2. If _resolution_.[[Module]] and _starResolution_.[[Module]] are
not the same Module Record, return ~ambiguous~.
3. If _resolution_.[[BindingName]] is not _starResolution_.[[BindingName]],
return ~ambiguous~.
flags: [module]
--- |
4205 |
- |
| namespace-unambiguous-if-export-star-as-from.js |
---
description: Exporting the same namespace object twice with `export * as foo` produces an unambiguous binding
esid: sec-source-text-module-record-initialize-environment
info: |
[...]
7. For each ImportEntry Record in of module.[[ImportEntries]], do
a. Let importedModule be GetImportedModule(module, in.[[ModuleRequest]]).
b. If in.[[ImportName]] is namespace-object, then
i. Let namespace be GetModuleNamespace(importedModule).
ii. Perform ! env.CreateImmutableBinding(in.[[LocalName]], true).
iii. Perform ! env.InitializeBinding(in.[[LocalName]], namespace).
c. Else,
i. Let resolution be importedModule.ResolveExport(in.[[ImportName]]).
ii. If resolution is either null or ambiguous, throw a SyntaxError exception.
Table 59 (Informative): Export Forms Mappings to ExportEntry Records
Export Statement Form [[ExportName]] [[ModuleRequest]] [[ImportName]] [[LocalName]]
export {x}; "x" null null "x"
export * as ns from "mod"; "ns" "mod" all null
16.2.1.7.1 ParseModule ( sourceText, realm, hostDefined )
[...]
10. For each ExportEntry Record ee of exportEntries, do
1. If ee.[[ModuleRequest]] is null, then
i. If importedBoundNames does not contain ee.[[LocalName]], then
1. Append ee to localExportEntries.
ii. Else,
1. Let ie be the element of importEntries whose [[LocalName]] is ee.[[LocalName]].
2. If ie.[[ImportName]] is namespace-object, then
a. NOTE: This is a re-export of an imported module namespace object.
b. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]], [[ImportName]]: ~all~, [[LocalName]]: *null*, [[ExportName]]: ee.[[ExportName]] } to indirectExportEntries.
3. Else,
a. NOTE: This is a re-export of a single name.
b. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]],
[[ImportName]]: ie.[[ImportName]], [[LocalName]]: null, [[ExportName]]:
ee.[[ExportName]] } to indirectExportEntries.
2. Else if ee.[[ImportName]] is all-but-default, then
[...]
3. Else,
a. Append ee to indirectExportEntries.
15.2.1.16.3 ResolveExport
[...]
6. For each ExportEntry Record e of module.[[IndirectExportEntries]], do
a. If e.[[ExportName]] is exportName, then
i. Assert: e.[[ModuleRequest]] is not null.
ii. Let importedModule be GetImportedModule(module, e.[[ModuleRequest]]).
iii. If e.[[ImportName]] is all, then
1. Assert: module does not provide the direct binding for this export.
2. Return ResolvedBinding Record { [[Module]]: importedModule, [[BindingName]]: namespace }.
[...]
9. Let starResolution be null.
10. For each ExportEntry Record e in module.[[StarExportEntries]], do
a. Let importedModule be GetImportedModule(module,
e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName,
resolveSet, exportStarSet).
c. If resolution is ~ambiguous~, return ~ambiguous~.
d. If resolution is not null, then
i. If starResolution is null, let starResolution be resolution.
ii. Else,
1. Assert: there is more than one * import that includes the
requested name.
2. If _resolution_.[[Module]] and _starResolution_.[[Module]] are
not the same Module Record, return ~ambiguous~.
3. If _resolution_.[[BindingName]] is not _starResolution_.[[BindingName]],
return ~ambiguous~.
flags: [module]
--- |
4231 |
- |
| namespace-unambiguous-if-import-source-and-export.js |
---
description: >
Re-exporting the same source-phase import via `import source mod from
'<module source>'; export { mod }` from two different modules produces an
unambiguous binding.
esid: sec-resolveexport
info: |
When ParseModule encounters `export { mod }` where `mod` is a local binding
introduced by `import source mod from "..."`, the ExportEntry is
reclassified as an indirect ExportEntry whose [[ImportName]] is ~source~.
ResolveExport ( exportName, resolveSet )
[...]
For each ExportEntry Record e of module.[[IndirectExportEntries]], do
a. If e.[[ExportName]] is exportName, then
[...]
iii. If e.[[ImportName]] is namespace, then [...]
iv. Else if e.[[ImportName]] is source, then
1. Assert: module does not provide the direct binding for this export.
2. Return ResolvedBinding Record { [[Module]]: importedModule,
[[BindingName]]: source }.
[...]
[...]
For each ExportEntry Record e of module.[[StarExportEntries]], do
a. Let importedModule be GetImportedModule(module, e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName, resolveSet).
c. If resolution is ambiguous, return ambiguous.
d. If resolution is not null, then
i. If starResolution is null, set starResolution to resolution.
ii. Else,
1. Assert: there is more than one * import that includes the requested name.
2. If resolution.[[Module]] and starResolution.[[Module]] are not the
same Module Record, return ambiguous.
3. If resolution.[[BindingName]] is not starResolution.[[BindingName]],
return ambiguous.
Both fixtures contain `import source mod from '<module source>'; export { mod };`.
The host resolves '<module source>' to the same Module Record in both, so
the two ResolveExport results carry the same [[Module]] and the same
[[BindingName]] (~source~). The star-export ambiguity check therefore
succeeds, the named import of `mod` from the re-export resolves to a
ResolvedBinding Record with [[BindingName]] ~source~, and InitializeEnvironment
initializes `mod` to the underlying [[ModuleSource]].
features: [source-phase-imports, source-phase-imports-module-source]
flags: [module]
--- |
3230 |
- |
| namespace-unambiguous-if-import-star-as-and-export.js |
---
description: Exporting the same namespace object twice with `import * as foo; export { foo }` produces an unambiguous binding
esid: sec-source-text-module-record-initialize-environment
info: |
[...]
7. For each ImportEntry Record in of module.[[ImportEntries]], do
a. Let importedModule be GetImportedModule(module, in.[[ModuleRequest]]).
b. If in.[[ImportName]] is namespace-object, then
i. Let namespace be GetModuleNamespace(importedModule).
ii. Perform ! env.CreateImmutableBinding(in.[[LocalName]], true).
iii. Perform ! env.InitializeBinding(in.[[LocalName]], namespace).
c. Else,
i. Let resolution be importedModule.ResolveExport(in.[[ImportName]]).
ii. If resolution is either null or ambiguous, throw a SyntaxError exception.
Table 59 (Informative): Export Forms Mappings to ExportEntry Records
Export Statement Form [[ExportName]] [[ModuleRequest]] [[ImportName]] [[LocalName]]
export * as ns from "mod"; "ns" "mod" all null
16.2.1.7.1 ParseModule ( sourceText, realm, hostDefined )
[...]
10. For each ExportEntry Record ee of exportEntries, do
1. If ee.[[ModuleRequest]] is null, then
i. If importedBoundNames does not contain ee.[[LocalName]], then
1. Append ee to localExportEntries.
ii. Else,
1. Let ie be the element of importEntries whose [[LocalName]] is ee.[[LocalName]].
2. If ie.[[ImportName]] is namespace-object, then
a. NOTE: This is a re-export of an imported module namespace object.
b. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]], [[ImportName]]: ~all~, [[LocalName]]: *null*, [[ExportName]]: ee.[[ExportName]] } to indirectExportEntries.
3. Else,
a. NOTE: This is a re-export of a single name.
b. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]],
[[ImportName]]: ie.[[ImportName]], [[LocalName]]: null, [[ExportName]]:
ee.[[ExportName]] } to indirectExportEntries.
2. Else if ee.[[ImportName]] is all-but-default, then
[...]
3. Else,
a. Append ee to indirectExportEntries.
15.2.1.16.3 ResolveExport
[...]
6. For each ExportEntry Record e of module.[[IndirectExportEntries]], do
a. If e.[[ExportName]] is exportName, then
i. Assert: e.[[ModuleRequest]] is not null.
ii. Let importedModule be GetImportedModule(module, e.[[ModuleRequest]]).
iii. If e.[[ImportName]] is all, then
1. Assert: module does not provide the direct binding for this export.
2. Return ResolvedBinding Record { [[Module]]: importedModule, [[BindingName]]: namespace }.
[...]
9. Let starResolution be null.
10. For each ExportEntry Record e in module.[[StarExportEntries]], do
a. Let importedModule be GetImportedModule(module,
e.[[ModuleRequest]]).
b. Let resolution be ? importedModule.ResolveExport(exportName,
resolveSet, exportStarSet).
c. If resolution is ~ambiguous~, return ~ambiguous~.
d. If resolution is not null, then
i. If starResolution is null, let starResolution be resolution.
ii. Else,
1. Assert: there is more than one * import that includes the
requested name.
2. If _resolution_.[[Module]] and _starResolution_.[[Module]] are
not the same Module Record, return ~ambiguous~.
3. If _resolution_.[[BindingName]] is not _starResolution_.[[BindingName]],
return ~ambiguous~.
flags: [module]
--- |
4165 |
- |
| omitted-from-namespace-1_FIXTURE.js |
|
188 |
- |
| omitted-from-namespace-2_FIXTURE.js |
|
189 |
- |
| omitted-from-namespace.js |
---
description: >
Ambiguous exports are not reflected in module namespace objects, nor do
they trigger an error upon resolution
esid: sec-moduledeclarationinstantiation
info: |
[...]
12. For each ImportEntry Record in in module.[[ImportEntries]], do
a. Let importedModule be ? HostResolveImportedModule(module,
in.[[ModuleRequest]]).
b. If in.[[ImportName]] is "*", then
i. Let namespace be ? GetModuleNamespace(importedModule).
[...]
15.2.1.18 Runtime Semantics: GetModuleNamespace
[...]
3. If namespace is undefined, then
[...]
c. For each name that is an element of exportedNames,
i. Let resolution be ? module.ResolveExport(name, « », « »).
ii. If resolution is null, throw a SyntaxError exception.
iii. If resolution is not "ambiguous", append name to
unambiguousNames.
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
flags: [module]
--- |
1484 |
- |
| omitted-from-namespace_FIXTURE.js |
|
249 |
- |
| shell.js |
|
0 |
- |