Layering: Lower module graph algorithms onto Abstract Module Record #1303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR moves the graph algorithms of module instantiation and evaluation and their associated fields from Source Text Module record down to Abstract Module Record.
This allows new module record types like Web Assembly or Dynamic Modules to share the same graph algorithms. This enables circular references for WASM<->JS, while avoiding the need to rewrite the entire graph algorithm and module status handling for each module type.
The following fields are moved to Abstract Module Record: [[RequestedModules]], [[Status]], [[EvaluationError]], [[DFSIndex]] and [[DFSAncestorIndex]].
The Instantiate and Evaluate concrete methods of Source Text Module Record are renamed InstantiateAll and EvaluateAll and moved to Abstract Module Record as well.
Individual module records then define the concrete methods
Instantiate()andEvaluate()as per-module instantiation and evaluation routines which are called once and provide the individual module type implementations, providing a convenient specification boundary for these new module records.Initial review by @littledan.
//cc @bmeck @allenwb