Skip to content

Commit 2de79e8

Browse files
Visit relevant optional re-exports in ReadyForSyncExecution
1 parent 3826047 commit 2de79e8

1 file changed

Lines changed: 43 additions & 1 deletion

File tree

spec.emu

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ contributors: Nicolò Ribaudo
4545
1. Let _binding_ be _m_.ResolveExport(_P_).
4646
1. Assert: _binding_ is a ResolvedBinding Record.
4747
1. <ins>For each Module Record _deferredModule_ of _binding_.[[DeferredModules]], do</ins>
48-
1. <ins>If ReadyForSyncExecution(_deferredModule_) is *false*, throw a *TypeError* exception.</ins>
48+
1. <ins>If ReadyForSyncExecution(_deferredModule_, <ins>« »</ins>) is *false*, throw a *TypeError* exception.</ins>
4949
1. <ins>Perform ? EvaluateModuleSync(_deferredModule_).</ins>
5050
1. Let _targetModule_ be _binding_.[[Module]].
5151
1. Assert: _targetModule_ is not *undefined*.
@@ -60,6 +60,48 @@ contributors: Nicolò Ribaudo
6060
<p>ResolveExport is side-effect free. Each time this operation is called with a specific _exportName_, _resolveSet_ pair as arguments it must return the same result. An implementation might choose to pre-compute or cache the ResolveExport results for the [[Exports]] of each module namespace exotic object.</p>
6161
</emu-note>
6262
</emu-clause>
63+
64+
<emu-clause id="sec-GetModuleExportsList" number="14">
65+
<h1>GetModuleExportsList ( _O_ )</h1>
66+
<emu-note type="editor">This section is defined in the <a href="https://tc39.es/proposal-defer-import-eval/#sec-GetModuleExportsList">Deferred Imports Evaluation</a> proposal.</emu-note>
67+
68+
<!-- not using type="abstract operation" to auto-generate this description, because it does not support inserting an <emu-note> at the beginning. -->
69+
<p>The abstract operation <dfn style="font-style: inherit">GetModuleExportsList</dfn> takes argument _O_ (a module namespace exotic object) and returns either a normal completion containing a List of Strings, or a throw completion. It returns a List whose elements are the names of the module's exports, triggering module evaluation if needed. It performs the following steps when called:</p>
70+
<emu-alg>
71+
1. If _O_.[[Deferred]] is *true*, then
72+
1. Let _m_ be _O_.[[Module]].
73+
1. If ReadyForSyncExecution(_m_, <ins>« »</ins>) is *false*, throw a *TypeError* exception.
74+
1. Perform ? EvaluateModuleSync(_m_).
75+
1. Return _O_.[[Exports]].
76+
</emu-alg>
77+
78+
<emu-clause id="sec-ReadyForSyncExecution" type="abstract operation">
79+
<h1>
80+
ReadyForSyncExecution (
81+
_module_: a Module Record,
82+
<ins>_importedNames_: ~all~ or a List of Strings,</ins>
83+
optional _seen_: a List of Module Records,
84+
): a Boolean
85+
</h1>
86+
<dl class="header"></dl>
87+
<emu-alg>
88+
1. If _module_ is not a Cyclic Module Record, return *true*.
89+
1. If _seen_ is not present, set _seen_ to a new empty List.
90+
1. If _seen_ contains _module_, return *true*.
91+
1. Append _module_ to _seen_.
92+
1. If _module_.[[Status]] is ~evaluated~, return *true*.
93+
1. If _module_.[[Status]] is ~evaluating~ or ~evaluating-async~, return *false*.
94+
1. Assert: _module_.[[Status]] is ~linked~.
95+
1. If _module_.[[HasTLA]] is *true*, return *false*.
96+
1. <ins>Let _requests_ be the list-concatenation of _module_.[[RequestedModules]] and _module_.GetOptionalIndirectExportsModuleRequests(_importedNames_ ).</ins>
97+
1. For each ModuleRequest Record _request_ of <del>_module_.[[RequestedModules]]</del><ins>_requests_</ins>, do
98+
1. Let _requiredModule_ be GetImportedModule(_module_, _request_).
99+
1. If ReadyForSyncExecution(_requiredModule_, <ins>_request_.[[ImportedNames]],</ins> _seen_) is *false*, then
100+
1. Return *false*.
101+
1. Return *true*.
102+
</emu-alg>
103+
</emu-clause>
104+
</emu-clause>
63105
</emu-clause>
64106
</emu-clause>
65107
</emu-clause>

0 commit comments

Comments
 (0)