Skip to content

Commit

Permalink
Normative: GetExportedNames adjustments for late-defined export names
Browse files Browse the repository at this point in the history
This provides two features needed for supporting late-defined export
names on custom module records. Firstly, a second argument to
GetExportedNames of the namespace module being constructed by this call,
allowing it to be tracked, and secondly permitting ResolveExport
and GetExportedNames operations to provide abrupt completions
corresponding to instantiation errors.
  • Loading branch information
guybedford committed Sep 12, 2018
1 parent 44e8058 commit 143cb9a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -21415,7 +21415,7 @@ <h1>Abstract Module Records</h1>
</tr>
<tr>
<td>
GetExportedNames(_exportStarSet_)
GetExportedNames(_exportStarSet_, _nsModule_)
</td>
<td>
Return a list of all names that are either directly or indirectly exported from this module.
Expand Down Expand Up @@ -22007,10 +22007,12 @@ <h1>ParseModule ( _sourceText_, _realm_, _hostDefined_ )</h1>
</emu-clause>

<emu-clause id="sec-getexportednames">
<h1>GetExportedNames ( _exportStarSet_ ) Concrete Method</h1>
<h1>GetExportedNames ( _exportStarSet_, _nsModule_ ) Concrete Method</h1>
<p>The GetExportedNames concrete method of a Source Text Module Record implements the corresponding Module Record abstract method.</p>
<p>It performs the following steps:</p>
<emu-alg>
1. Assert: _exportStarSet_ is a List of Module Records.
1. Assert: _nsModule_ is a Module Record.
1. Let _module_ be this Source Text Module Record.
1. If _exportStarSet_ contains _module_, then
1. Assert: We've reached the starting point of an `import *` circularity.
Expand All @@ -22025,7 +22027,7 @@ <h1>GetExportedNames ( _exportStarSet_ ) Concrete Method</h1>
1. Append _e_.[[ExportName]] to _exportedNames_.
1. For each ExportEntry Record _e_ in _module_.[[StarExportEntries]], do
1. Let _requestedModule_ be ? HostResolveImportedModule(_module_, _e_.[[ModuleRequest]]).
1. Let _starNames_ be ? _requestedModule_.GetExportedNames(_exportStarSet_).
1. Let _starNames_ be ? _requestedModule_.GetExportedNames(_exportStarSet_, _nsModule_).
1. For each element _n_ of _starNames_, do
1. If SameValue(_n_, `"default"`) is *false*, then
1. If _n_ is not an element of _exportedNames_, then
Expand Down Expand Up @@ -22382,7 +22384,7 @@ <h1>Runtime Semantics: GetModuleNamespace ( _module_ )</h1>
1. Return _namespace_.
</emu-alg>
<emu-note>
<p>The only way GetModuleNamespace can throw is via one of the triggered HostResolveImportedModule calls. Unresolvable names are simply excluded from the namespace at this point. They will lead to a real instantiation error later unless they are all ambiguous star exports that are not explicitly requested anywhere.</p>
<p>The only ways GetModuleNamespace can throw is either via one of the triggered HostResolveImportedModule calls or if GetExportedNames throws for a specific module record implementation. Unresolvable names are simply excluded from the namespace at this point. They will lead to a real instantiation error later unless they are all ambiguous star exports that are not explicitly requested anywhere.</p>
</emu-note>
</emu-clause>

Expand Down

0 comments on commit 143cb9a

Please sign in to comment.