@@ -302,6 +302,60 @@ <h1>Runtime Semantics: Evaluation</h1>
302302 </emu-clause >
303303</emu-clause >
304304
305+ <emu-clause id =" sec-ecmascript-language-scripts-and-modules" >
306+ <h1 >ECMAScript Language: Scripts and Modules</h1 >
307+
308+ <emu-clause id =" sec-modules" >
309+ <h1 >Modules</h1 >
310+
311+ <emu-clause id =" sec-module-semantics" >
312+ <h1 >Module Semantics</h1 >
313+
314+ <emu-clause id =" sec-source-text-module-records" >
315+ <h1 >Source Text Module Records</h1 >
316+ <emu-clause id =" sec-source-text-module-record-execute-module" type =" concrete method" >
317+ <h1 >
318+ ExecuteModule (
319+ optional _capability_ : a PromiseCapability Record,
320+ ): either a normal completion containing ~unused~ or a throw completion
321+ </h1 >
322+ <dl class =" header" >
323+ <dt >for</dt >
324+ <dd >a Source Text Module Record _module_ </dd >
325+ </dl >
326+
327+ <emu-alg >
328+ 1. Let _moduleContext_ be a new ECMAScript code execution context.
329+ 1. Set the Function of _moduleContext_ to *null* .
330+ 1. Set the Realm of _moduleContext_ to _module_ .[[Realm]].
331+ 1. Set the ScriptOrModule of _moduleContext_ to _module_ .
332+ 1. Assert: _module_ has been linked and declarations in its module environment have been instantiated.
333+ 1. Set the VariableEnvironment of _moduleContext_ to _module_ .[[Environment]].
334+ 1. Set the LexicalEnvironment of _moduleContext_ to _module_ .[[Environment]].
335+ 1. Suspend the running execution context.
336+ 1. <ins >Let _moduleContextMapping_ be a new empty list.</ins >
337+ 1. <ins >Let _previousContextMapping_ be AsyncContextSwap(_moduleContextMapping_ ).</ins >
338+ 1. If _module_ .[[HasTLA]] is *false* , then
339+ 1. Assert: _capability_ is not present.
340+ 1. Push _moduleContext_ onto the execution context stack; _moduleContext_ is now the running execution context.
341+ 1. Let _result_ be Completion(Evaluation of _module_ .[[ECMAScriptCode]]).
342+ 1. <ins >AsyncContextSwap(_previousContextMapping_ ).</ins >
343+ 1. Suspend _moduleContext_ and remove it from the execution context stack.
344+ 1. Resume the context that is now on the top of the execution context stack as the running execution context.
345+ 1. If _result_ is an abrupt completion, then
346+ 1. Return ? _result_ .
347+ 1. Else,
348+ 1. Assert: _capability_ is a PromiseCapability Record.
349+ 1. Perform AsyncBlockStart(_capability_ , _module_ .[[ECMAScriptCode]], _moduleContext_ ).
350+ 1. <ins >AsyncContextSwap(_previousContextMapping_ ).</ins >
351+ 1. Return ~unused~ .
352+ </emu-alg >
353+ </emu-clause >
354+ </emu-clause >
355+ </emu-clause >
356+ </emu-clause >
357+ </emu-clause >
358+
305359<emu-clause id =" sec-control-abstraction-objects" >
306360 <h1 >Control Abstraction Objects</h1 >
307361
0 commit comments