Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the Compiler
inputs
member variable.
The `inputs`, `modules` and `moduleGraph` compiler data structures overlap, which violates the SPOT rule and makes maintenance of the compiler's internal state more error-prone. This CL remedies part of the problem by removing `inputs` in favor of a `JSModuleGraph#getAllInputs` method, which returns an iterable over inputs in dependency order. Note that it's already the case that `inputs` is in dependency order, since `initModules` and `rebuildInputsFromModules` (two of the three places where `inputs` is set, the third being `restoreState`) already initialize it in that manner. Thus, in most places where `inputs` occurs, we can simply replace it by a `moduleGraph.getAllInputs()` call. The exceptions are the methods that mutate the module graph: `hoistExterns` and `hoistNoCompileFiles`. In both cases, iteration must be over a copy of `getAllInputs()` to prevent concurrent modification. Also note that, in `orderInputs`, passing `inputs` as an argument into `JSModuleGraph#manageDependencies` is redundant, since the graph itself contains that information. Finally, a couple of places verify that the compiler has been initialized by a null check on `inputs`. These must be replaced by a null check on `moduleGraph`. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=211408645
- Loading branch information
1 parent
201741d
commit 58ca0e1
Showing
8 changed files
with
106 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters