Don't gather extern properties from files.
Including these property names substantially increases the size of TypedASTs, but is not needed. Library-level builds don't depend on these names, and binary-level builds will receive the complete set by merging the framgents from all TypedAST inputs.
@@ -19,7 +19,6 @@ package com.google.javascript.jscomp;
import static com.google.common.base.Preconditions.checkState;
import com.google.common.collect.ImmutableSet;
-import com.google.javascript.jscomp.NodeTraversal.AbstractPostOrderCallback;
import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.Token;
@@ -32,7 +31,7 @@ import java.util.LinkedHashSet;
* exporting local property definitions, the externs may be modified after type checking, and we
* want to collect the new names as well.
*/
-final class GatherExternProperties extends AbstractPostOrderCallback implements CompilerPass {
+final class GatherExternProperties implements NodeTraversal.Callback, CompilerPass {
private final AbstractCompiler compiler;
private final LinkedHashSet<String> externProperties = new LinkedHashSet<>();
@@ -51,6 +50,11 @@ final class GatherExternProperties extends AbstractPostOrderCallback implements
compiler.setExternProperties(ImmutableSet.copyOf(externProperties));
}
+ @Override
+ public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
+ return !n.isScript() || !NodeUtil.isFromTypeSummary(n);
+ }
+
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
switch (n.getToken()) {
