Tiny tree search optimization.
@@ -36,7 +36,6 @@ import com.google.template.soy.jbcsrc.shared.CompiledTemplates;
import com.google.template.soy.jbcsrc.shared.Names;
import com.google.template.soy.plugin.java.internal.PluginAnalyzer;
import com.google.template.soy.plugin.java.restricted.SoyJavaSourceFunction;
-import com.google.template.soy.soytree.ExternNode;
import com.google.template.soy.soytree.FileSetMetadata;
import com.google.template.soy.soytree.PartialFileSetMetadata;
import com.google.template.soy.soytree.SoyFileNode;
@@ -160,7 +159,8 @@ public final class BytecodeCompiler {
}
// Collect all instances from all declared externs.
- SoyTreeUtils.allNodesOfType(fileSet, ExternNode.class)
+ fileSet.getChildren().stream()
+ .flatMap(f -> f.getExterns().stream())
.filter(e -> e.getJavaImpl().isPresent())
.map(e -> e.getJavaImpl().get())
.filter(j -> !j.isStatic())
