Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,60 @@ <h1>Runtime Semantics: Evaluation</h1>
</emu-clause>
</emu-clause>

<emu-clause id="sec-ecmascript-language-scripts-and-modules">
<h1>ECMAScript Language: Scripts and Modules</h1>

<emu-clause id="sec-modules">
<h1>Modules</h1>

<emu-clause id="sec-module-semantics">
<h1>Module Semantics</h1>

<emu-clause id="sec-source-text-module-records">
<h1>Source Text Module Records</h1>
<emu-clause id="sec-source-text-module-record-execute-module" type="concrete method">
<h1>
ExecuteModule (
optional _capability_: a PromiseCapability Record,
): either a normal completion containing ~unused~ or a throw completion
</h1>
<dl class="header">
<dt>for</dt>
<dd>a Source Text Module Record _module_</dd>
</dl>

<emu-alg>
1. Let _moduleContext_ be a new ECMAScript code execution context.
1. Set the Function of _moduleContext_ to *null*.
1. Set the Realm of _moduleContext_ to _module_.[[Realm]].
1. Set the ScriptOrModule of _moduleContext_ to _module_.
1. Assert: _module_ has been linked and declarations in its module environment have been instantiated.
1. Set the VariableEnvironment of _moduleContext_ to _module_.[[Environment]].
1. Set the LexicalEnvironment of _moduleContext_ to _module_.[[Environment]].
1. Suspend the running execution context.
1. <ins>Let _moduleContextMapping_ be a new empty list.</ins>
1. <ins>Let _previousContextMapping_ be AsyncContextSwap(_moduleContextMapping_).</ins>
1. If _module_.[[HasTLA]] is *false*, then
1. Assert: _capability_ is not present.
1. Push _moduleContext_ onto the execution context stack; _moduleContext_ is now the running execution context.
1. Let _result_ be Completion(Evaluation of _module_.[[ECMAScriptCode]]).
1. <ins>AsyncContextSwap(_previousContextMapping_).</ins>
1. Suspend _moduleContext_ and remove it from the execution context stack.
1. Resume the context that is now on the top of the execution context stack as the running execution context.
1. If _result_ is an abrupt completion, then
1. Return ? _result_.
1. Else,
1. Assert: _capability_ is a PromiseCapability Record.
1. Perform AsyncBlockStart(_capability_, _module_.[[ECMAScriptCode]], _moduleContext_).
1. <ins>AsyncContextSwap(_previousContextMapping_).</ins>
1. Return ~unused~.
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
</emu-clause>
</emu-clause>

<emu-clause id="sec-control-abstraction-objects">
<h1>Control Abstraction Objects</h1>

Expand Down