Skip to content

Commit 1cca5ca

Browse files
wip
1 parent f23069a commit 1cca5ca

1 file changed

Lines changed: 42 additions & 9 deletions

File tree

spec.emu

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,9 +2233,18 @@ contributors: Nicolò Ribaudo
22332233

22342234
<emu-alg>
22352235
1. Assert: If _module_ is a Cyclic Module Record, then _module_.[[Status]] is not ~new~ or ~unlinked~.
2236+
1. <ins>If _importedNames_ is not ~all~, set _importedNames_ to a copy of _importedNames_ sorted by lexicographic code unit order.</ins>
22362237
1. <ins>Let _namespace_ be ~empty~.</ins>
2237-
1. <ins>If _importedNames_ is ~all~, then</ins>
2238-
1. <ins>If _phase_ is ~defer~, set _namespace_ to _module_.[[DeferredNamespace]]. Otherwise, set _namespace_ to _module_.[[Namespace]].</ins>
2238+
1. <ins>For each Record _r_ of _module_.[[Namespaces]], do</ins>
2239+
1. <ins>If _r_.[[Phase]] is _phase_, then</ins>
2240+
1. <ins>If _importedNames_ is ~all~, then</ins>
2241+
1. <ins>If _r_.[[ImportedNames]] is ~all~, then</ins>
2242+
1. <ins>Assert: _namespace_ is ~empty~.</ins>
2243+
1. <ins>Set _namespace_ to _r_.[[NamespaceObject]].</ins>
2244+
1. <ins>Else if _r_.[[ImportedNames]] is a List of Strings, then</ins>
2245+
1. <ins>If _importedNames_ and _r_.[[ImportedNames]] have the same contents, then</ins>
2246+
1. <ins>Assert: _namespace_ is ~empty~.</ins>
2247+
1. <ins>Set _namespace_ to _r_.[[NamespaceObject]].</ins>
22392248
1. If _namespace_ is ~empty~, then
22402249
1. Let _exportedNames_ be _module_.GetExportedNames().
22412250
1. Let _unambiguousNames_ be a new empty List.
@@ -2245,18 +2254,42 @@ contributors: Nicolò Ribaudo
22452254
1. Let _resolution_ be _module_.ResolveExport(_name_).
22462255
1. If _resolution_ is a ResolvedBinding Record, append _name_ to _unambiguousNames_.
22472256
1. Set _namespace_ to ModuleNamespaceCreate(_module_, _unambiguousNames_, _phase_).
2248-
1. <ins>If _importedNames_ is ~all~, then</ins>
2249-
1. <ins>If _phase_ is ~defer~, then</ins>
2250-
1. <ins>Assert: _module_.[[DeferredNamespace]] is ~empty~.</ins>
2251-
1. <ins>Set _module_.[[DeferredNamespace]] to _namespace_.</ins>
2252-
1. Else,
2253-
1. <ins>Assert: _module_.[[Namespace]] is ~empty~.</ins>
2254-
1. <ins>Set _module_.[[Namespace]] to _namespace_.</ins>
2257+
1. <ins>Append the Record { [[Phase]]: _phase_, [[ImportedNames]]: _importedNames_, [[NamespaceObject]]: _namespace_ } to _module_.[[Namespaces]].</ins>
22552258
1. Return _namespace_.
22562259
</emu-alg>
22572260
<emu-note>
22582261
<p>GetModuleNamespace never throws. Instead, unresolvable names are simply excluded from the namespace at this point. They will lead to a real linking error later unless they are all ambiguous star exports that are not explicitly requested anywhere.</p>
22592262
</emu-note>
2263+
2264+
<p>A <dfn id="modulenamespacekey-record">ModuleNamespaceKey Record</dfn> describes which namespace object of a given module has been requested. It consists of the following fields:</p>
2265+
<emu-table id="table-modulenamespacekey-fields" caption="ModuleNamespaceKey Record Fields">
2266+
<table>
2267+
<tr>
2268+
<th>
2269+
Field Name
2270+
</th>
2271+
<th>
2272+
Value Type
2273+
</th>
2274+
</tr>
2275+
<tr>
2276+
<td>
2277+
[[Phase]]
2278+
</td>
2279+
<td>
2280+
~defer~ or ~evaluation~
2281+
</td>
2282+
</tr>
2283+
<tr>
2284+
<td>
2285+
[[ImportedNames]]
2286+
</td>
2287+
<td>
2288+
~all~ or a List of Strings
2289+
</td>
2290+
</tr>
2291+
</table>
2292+
</emu-table>
22602293
</emu-clause>
22612294

22622295
<emu-clause id="sec-source-text-module-record-module-record-methods">

0 commit comments

Comments
 (0)