You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. If _binding_.[[BindingName]] is ~namespace~, then
@@ -500,7 +500,7 @@ contributors: Nicolò Ribaudo
500
500
ResolveExport(_exportName_ [, _resolveSet_])
501
501
</td>
502
502
<td>
503
-
<p>Return the binding of a name exported by this module. Bindings are represented by a <dfn id="resolvedbinding-record" variants="ResolvedBinding Records">ResolvedBinding Record</dfn>, of the form { [[Module]]: Module Record, [[BindingName]]: String | ~namespace~, <ins>[[DeferredModules]]: List of Module Records</ins> }. If the export is a Module Namespace Object without a direct binding in any module, [[BindingName]] will be set to ~namespace~. <ins>[[DeferredModules]] is the list of modules imported through `export defer` that the binding resolution process needs to go through which need to be evaluated in order to have access to the resolved binding.</ins> Return *null* if the name cannot be resolved, or ~ambiguous~ if multiple bindings were found.</p>
503
+
<p>Return the binding of a name exported by this module. Bindings are represented by a <dfn id="resolvedbinding-record" variants="ResolvedBinding Records">ResolvedBinding Record</dfn>, of the form { [[Module]]: Module Record, [[BindingName]]: String | ~namespace~}. If the export is a Module Namespace Object without a direct binding in any module, [[BindingName]] will be set to ~namespace~. Return *null* if the name cannot be resolved, or ~ambiguous~ if multiple bindings were found.</p>
504
504
<p>Each time this operation is called with a specific _exportName_, _resolveSet_ pair as arguments it must return the same result.</p>
505
505
<p>LoadRequestedModules must have completed successfully prior to invoking this method.</p>
<p>Returns a promise for the evaluation of this module and its dependencies, resolving on successful evaluation or if it has already been evaluated successfully, and rejecting for an evaluation error or if it has already been evaluated unsuccessfully. If the promise is rejected, hosts are expected to handle the promise rejection and rethrow the evaluation error.</p>
524
-
<p>Link must have completed successfully prior to invoking this method.</p>
524
+
<p><ins>When this module is a Cyclic Module Record, _importedNames_ is the list of binding names (or ~all~) whose additional modules need to be evaluated, for usage with GetOptionalIndirectExportsModuleRequests(). By default, modules re-exported by this module through GetOptionalIndirectExportsModuleRequests() are not evaluated.</ins></p>
525
+
<p>Link must have completed successfully prior to invoking this method<ins>, with an _importNames_ list that includes at least the _importedNames_ passed to Evaluate</ins>.</p>
525
526
</td>
526
527
</tr>
527
528
</table>
@@ -531,6 +532,7 @@ contributors: Nicolò Ribaudo
531
532
<h1>
532
533
EvaluateModuleSync (
533
534
_module_: a Module Record,
535
+
<ins>optional _importedNames_: ~all~ or a List of Strings,</ins>
534
536
): either a normal completion containing ~unused~ or a throw completion
535
537
</h1>
536
538
<dl class="header">
@@ -539,8 +541,9 @@ contributors: Nicolò Ribaudo
539
541
</dl>
540
542
541
543
<emu-alg>
542
-
1. If ReadyForSyncExecution(_module_, « ») is *false*, throw a *TypeError* exception.
543
-
1. Let _promise_ be _module_.Evaluate().
544
+
1. <ins>If _importedNames_ is not present, let _importedNames_ be « ».</ins>
545
+
1. If ReadyForSyncExecution(_module_, <ins>_importedNames_</ins>) is *false*, throw a *TypeError* exception.
546
+
1. Let _promise_ be _module_.Evaluate(<ins>_importedNames_</ins>).
544
547
1. Assert: _promise_.[[PromiseState]] is either ~fulfilled~ or ~rejected~.
545
548
1. If _promise_.[[PromiseState]] is ~rejected~, then
546
549
1. If _promise_.[[PromiseIsHandled]] is *false*, perform HostPromiseRejectionTracker(_promise_, *"handle"*).
@@ -557,7 +560,11 @@ contributors: Nicolò Ribaudo
557
560
optional _seen_: a List of Module Records,
558
561
): a Boolean
559
562
</h1>
560
-
<dl class="header"></dl>
563
+
<dl class="header">
564
+
<dt>description</dt>
565
+
<!-- ‍ to prevent ecmarkup from wrapping this in a <p> -->
566
+
<dd>‍<ins>It tests whether a given (_module_, _importedNames_) pair can be safely evaluated through EvaluateModuleSync.</ins></dd>
567
+
</dl>
561
568
<emu-alg>
562
569
1. If _module_ is not a Cyclic Module Record, return *true*.
563
570
1. If _seen_ is not present, set _seen_ to a new empty List.
1. <ins>Let _topLevelPromise_ be _capability_.[[Promise]].</ins>
1118
+
1. <ins>If _topLevelPromise_.[[PromiseState]] is ~rejected~, return _topLevelPromise_.</ins>
1119
+
1. <ins>Let _indirectRequests_ be _module_.GetOptionalIndirectExportsModuleRequests(_importedNames_ ).</ins>
1120
+
1. <ins>Let _promises_ be « _topLevelPromise_ ».</ins>
1121
+
1. <ins>For each ModuleRequest Record _request_ of _indirectRequests_, do</ins>
1122
+
1. <ins>Let _requiredModule_ be GetImportedModule(_module_, _request_).</ins>
1123
+
1. <ins>Assert: _requiredModule_.[[Status]] is one of ~linked~, ~evaluating-async~, or ~evaluated~.</ins>
1124
+
1. <ins>Let _innerPromise_ be _requiredModule_.Evaluate(_request_.[[ImportedNames]]).</ins>
1125
+
1. <ins>If _innerPromise_.[[PromiseState]] is ~rejected~, return _innerPromise_.</ins>
1126
+
1. <ins>Append _innerPromise_ to _promises_.</ins>
1127
+
1. <ins>If _promises_ contains a Promise _P_ such that _P_.[[PromiseState]] is ~pending~, then</ins>
1128
+
1. <ins>NOTE: If all modules in the graph are synchronous, the usage of promises is an internal specification detail. In that case, we do not use PerformPromiseAll to keep returning an already settled promise.</ins>
1. If _resolution_.[[Module]] and _starResolution_.[[Module]] are not the same Module Record, return ~ambiguous~.
1599
1618
1. If _resolution_.[[BindingName]] is not _starResolution_.[[BindingName]] and either _resolution_.[[BindingName]] or _starResolution_.[[BindingName]] is ~namespace~, return ~ambiguous~.
1600
1619
1. If _resolution_.[[BindingName]] is a String, _starResolution_.[[BindingName]] is a String, and _resolution_.[[BindingName]] is not _starResolution_.[[BindingName]], return ~ambiguous~.
1601
-
1. <ins>Let _deferredModules_ be the list-concatenation of _starResolution_.[[DeferredModules]] and _resolution_.[[DeferredModules]].</ins>
1602
-
1. <ins>Set _starResolution_ to the ResolvedBinding Record { [[Module]]: _starResolution_.[[Module]], [[BindingName]]: _starResolution_.[[BindingName]], [[DeferredModules]]: _deferredModules_ }.</ins>
0 commit comments