Skip to content

Commit

Permalink
Add GetRequestedModules() abstract method to Cyclic Module Record, wi…
Browse files Browse the repository at this point in the history
…th implementation for Source Text Module Record. Refactor InnerModuleInstantiation/InnerModuleEvaluation to use this instead of [[RequestedModules]] directly.
  • Loading branch information
dandclark committed Apr 4, 2019
1 parent a09fc23 commit 10dfe19
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -21704,6 +21704,14 @@ <h1>Cyclic Module Records</h1>
Initialize the execution context of the module and evaluate the module's code within it.
</td>
</tr>
<tr>
<td>
GetRequestedModules()
</td>
<td>
Returns a List of Module Records constituting the modules imported from this module. The List is source code occurrence ordered.
</td>
</tr>
</tbody>
</table>
</emu-table>
Expand Down Expand Up @@ -21754,8 +21762,8 @@ <h1>InnerModuleInstantiation ( _module_, _stack_, _index_ )</h1>
1. Set _module_.[[DFSAncestorIndex]] to _index_.
1. Increase _index_ by 1.
1. Append _module_ to _stack_.
1. For each String _required_ that is an element of _module_.[[RequestedModules]], do
1. Let _requiredModule_ be ? HostResolveImportedModule(_module_, _required_).
1. Let _requiredModules_ be _module_.GetRequestedModules()
1. For each module _requiredModule_ that is an element of _requiredModules_, do
1. Set _index_ to ? InnerModuleInstantiation(_requiredModule_, _stack_, _index_).
1. Assert: _requiredModule_.[[Status]] is either `"instantiating"`, `"instantiated"`, or `"evaluated"`.
1. Assert: _requiredModule_.[[Status]] is `"instantiating"` if and only if _requiredModule_ is in _stack_.
Expand Down Expand Up @@ -21825,9 +21833,8 @@ <h1>InnerModuleEvaluation ( _module_, _stack_, _index_ )</h1>
1. Set _module_.[[DFSAncestorIndex]] to _index_.
1. Increase _index_ by 1.
1. Append _module_ to _stack_.
1. For each String _required_ that is an element of _module_.[[RequestedModules]], do
1. Let _requiredModule_ be ! HostResolveImportedModule(_module_, _required_).
1. NOTE: Instantiate must be completed successfully prior to invoking this method, so every requested module is guaranteed to resolve successfully.
1. Let _requiredModules_ be _module_.GetRequestedModules().
1. For each module _requiredModule_ that is an element of _requiredModules_, do
1. Set _index_ to ? InnerModuleEvaluation(_requiredModule_, _stack_, _index_).
1. Assert: _requiredModule_.[[Status]] is either `"evaluating"` or `"evaluated"`.
1. Assert: _requiredModule_.[[Status]] is `"evaluating"` if and only if _requiredModule_ is in _stack_.
Expand Down Expand Up @@ -22543,6 +22550,23 @@ <h1>ExecuteModule ( ) Concrete Method</h1>
1. Return Completion(_result_).
</emu-alg>
</emu-clause>

<emu-clause id="sec-source-text-module-record-get-requested-modules" aoid="GetRequestedModules">
<h1>GetRequestedModules ( ) Concrete Method</h1>

<p>The GetRequestedModules concrete method of a Source Text Module Record implements the corresponding Cyclic Module Record abstract method.</p>

<p>This abstract method performs the following steps:</p>

<emu-alg>
1. Let _module_ be this Source Text Module Record.
1. Let _requestedModules_ be an empty List of Abstract Module Records.
1. For each String _requested_ that is an element of _module_.[[RequestedModules]], do
1. Let _requestedModule_ be ! HostResolveImportedModule(_module_, _requested_).
1. NOTE: Instantiate must be completed successfully prior to invoking this method, so every requested module is guaranteed to resolve successfully.
1. Append _requestedModule_ to _requestedModules_.
1. Return _requestedModules_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-hostresolveimportedmodule" aoid="HostResolveImportedModule">
Expand Down

0 comments on commit 10dfe19

Please sign in to comment.