@@ -21783,15 +21783,15 @@ <h1>Cyclic Module Records</h1>
2178321783 InitializeEnvironment()
2178421784 </td>
2178521785 <td>
21786- Initialize the Lexical Environment of the module, including resolving all imported bindings.
21786+ Initialize the Lexical Environment of the module, including resolving all imported bindings, and create the module's execution context .
2178721787 </td>
2178821788 </tr>
2178921789 <tr>
2179021790 <td>
2179121791 ExecuteModule()
2179221792 </td>
2179321793 <td>
21794- Initialize the execution context of the module and evaluate the module 's code within it .
21794+ Evaluate the module's code within its execution context .
2179521795 </td>
2179621796 </tr>
2179721797 </tbody>
@@ -22017,6 +22017,17 @@ <h1>Source Text Module Records</h1>
2201722017 The result of parsing the source text of this module using |Module| as the goal symbol.
2201822018 </td>
2201922019 </tr>
22020+ <tr>
22021+ <td>
22022+ [[Context]]
22023+ </td>
22024+ <td>
22025+ An ECMAScript execution context.
22026+ </td>
22027+ <td>
22028+ The execution context associated with this module.
22029+ </td>
22030+ </tr>
2202022031 <tr>
2202122032 <td>
2202222033 [[ImportEntries]]
@@ -22475,7 +22486,7 @@ <h1>ParseModule ( _sourceText_, _realm_, _hostDefined_ )</h1>
2247522486 1. Append _ee_ to _starExportEntries_.
2247622487 1. Else,
2247722488 1. Append _ee_ to _indirectExportEntries_.
22478- 1. Return Source Text Module Record { [[Realm]]: _realm_, [[Environment]]: *undefined*, [[Namespace]]: *undefined*, [[Status]]: `"unlinked"`, [[EvaluationError]]: *undefined*, [[HostDefined]]: _hostDefined_, [[ECMAScriptCode]]: _body_, [[RequestedModules]]: _requestedModules_, [[ImportEntries]]: _importEntries_, [[LocalExportEntries]]: _localExportEntries_, [[IndirectExportEntries]]: _indirectExportEntries_, [[StarExportEntries]]: _starExportEntries_, [[DFSIndex]]: *undefined*, [[DFSAncestorIndex]]: *undefined* }.
22489+ 1. Return Source Text Module Record { [[Realm]]: _realm_, [[Environment]]: *undefined*, [[Namespace]]: *undefined*, [[Status]]: `"unlinked"`, [[EvaluationError]]: *undefined*, [[HostDefined]]: _hostDefined_, [[ECMAScriptCode]]: _body_, [[Context]]: ~empty~ , [[RequestedModules]]: _requestedModules_, [[ImportEntries]]: _importEntries_, [[LocalExportEntries]]: _localExportEntries_, [[IndirectExportEntries]]: _indirectExportEntries_, [[StarExportEntries]]: _starExportEntries_, [[DFSIndex]]: *undefined*, [[DFSAncestorIndex]]: *undefined* }.
2247922490 </emu-alg>
2248022491 <emu-note>
2248122492 <p>An implementation may parse module source text and analyse it for Early Error conditions prior to the evaluation of ParseModule for that module source text. However, the reporting of any errors must be deferred until the point where this specification actually performs ParseModule upon that source text.</p>
@@ -22592,6 +22603,15 @@ <h1>InitializeEnvironment ( ) Concrete Method</h1>
2259222603 1. Let _resolution_ be ? _importedModule_.ResolveExport(_in_.[[ImportName]]).
2259322604 1. If _resolution_ is *null* or `"ambiguous"`, throw a *SyntaxError* exception.
2259422605 1. Call _envRec_.CreateImportBinding(_in_.[[LocalName]], _resolution_.[[Module]], _resolution_.[[BindingName]]).
22606+ 1. Let _moduleCxt_ be a new ECMAScript code execution context.
22607+ 1. Set the Function of _moduleCxt_ to *null*.
22608+ 1. Assert: _module_.[[Realm]] is not *undefined*.
22609+ 1. Set the Realm of _moduleCxt_ to _module_.[[Realm]].
22610+ 1. Set the ScriptOrModule of _moduleCxt_ to _module_.
22611+ 1. Set the VariableEnvironment of _moduleCxt_ to _module_.[[Environment]].
22612+ 1. Set the LexicalEnvironment of _moduleCxt_ to _module_.[[Environment]].
22613+ 1. Set _module_.[[Context]] to _moduleCxt_.
22614+ 1. Push _moduleCxt_ onto the execution context stack; _moduleCxt_ is now the running execution context.
2259522615 1. Let _code_ be _module_.[[ECMAScriptCode]].
2259622616 1. Let _varDeclarations_ be the VarScopedDeclarations of _code_.
2259722617 1. Let _declaredVarNames_ be a new empty List.
@@ -22611,6 +22631,7 @@ <h1>InitializeEnvironment ( ) Concrete Method</h1>
2261122631 1. If _d_ is a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|, then
2261222632 1. Let _fo_ be InstantiateFunctionObject of _d_ with argument _env_.
2261322633 1. Call _envRec_.InitializeBinding(_dn_, _fo_).
22634+ 1. Remove _moduleCxt_ from the execution context stack.
2261422635 1. Return NormalCompletion(~empty~).
2261522636 </emu-alg>
2261622637 </emu-clause>
@@ -22624,15 +22645,8 @@ <h1>ExecuteModule ( ) Concrete Method</h1>
2262422645
2262522646 <emu-alg>
2262622647 1. Let _module_ be this Source Text Module Record.
22627- 1. Let _moduleCxt_ be a new ECMAScript code execution context.
22628- 1. Set the Function of _moduleCxt_ to *null*.
22629- 1. Assert: _module_.[[Realm]] is not *undefined*.
22630- 1. Set the Realm of _moduleCxt_ to _module_.[[Realm]].
22631- 1. Set the ScriptOrModule of _moduleCxt_ to _module_.
22632- 1. Assert: _module_ has been linked and declarations in its module environment have been instantiated.
22633- 1. Set the VariableEnvironment of _moduleCxt_ to _module_.[[Environment]].
22634- 1. Set the LexicalEnvironment of _moduleCxt_ to _module_.[[Environment]].
2263522648 1. Suspend the currently running execution context.
22649+ 1. Let _moduleCxt_ be _module_.[[Context]].
2263622650 1. Push _moduleCxt_ onto the execution context stack; _moduleCxt_ is now the running execution context.
2263722651 1. Let _result_ be the result of evaluating _module_.[[ECMAScriptCode]].
2263822652 1. Suspend _moduleCxt_ and remove it from the execution context stack.
0 commit comments