Skip to content

Commit 88dd3e6

Browse files
concavelenzcopybara-github
authored andcommitted
Avoid building the list of inputs twice.
PiperOrigin-RevId: 718066215
1 parent ec52c8f commit 88dd3e6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/com/google/javascript/jscomp/Compiler.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -3561,10 +3561,11 @@ protected Node getNodeForCodeInsertion(@Nullable JSChunk chunk) {
35613561
return this.inputsById.get(SYNTHETIC_CODE_INPUT_ID).getAstRoot(this);
35623562
}
35633563
if (chunk == null) {
3564-
if (chunkGraph == null || Iterables.isEmpty(chunkGraph.getAllInputs())) {
3564+
Iterable<CompilerInput> allInputs = chunkGraph.getAllInputs();
3565+
if (chunkGraph == null || Iterables.isEmpty(allInputs)) {
35653566
throw new IllegalStateException("No inputs");
35663567
}
3567-
CompilerInput firstInput = Iterables.getFirst(chunkGraph.getAllInputs(), null);
3568+
CompilerInput firstInput = Iterables.getFirst(allInputs, null);
35683569
return checkNotModule(firstInput.getAstRoot(this), "Cannot insert code into a module");
35693570
}
35703571

0 commit comments

Comments
 (0)