Skip to content

Commit

Permalink
Rollback of "Change InlineAliases from an always-on pass to a CommonJ…
Browse files Browse the repository at this point in the history
…S/J2cl-only pass." This change is actually a no-op until J2clPass defaults to off, which will be submitted separately. Then this change can be rolled forward.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130335519
  • Loading branch information
blickly committed Aug 15, 2016
1 parent 74c0c3d commit ee43373
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/com/google/javascript/jscomp/DefaultPassConfig.java
Expand Up @@ -397,7 +397,7 @@ protected List<PassFactory> getChecks() {
checks.add(newTypeInference);
}

if (options.processCommonJSModules || options.j2clPassMode.shouldAddJ2clPasses()) {
if (!options.allowsHotswapReplaceScript()) {
checks.add(inlineTypeAliases);
}

Expand Down
20 changes: 4 additions & 16 deletions src/com/google/javascript/jscomp/InlineAliases.java
Expand Up @@ -21,6 +21,7 @@
import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.rhino.JSDocInfo.Visibility;
import com.google.javascript.rhino.Node;

import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
Expand Down Expand Up @@ -48,24 +49,11 @@ final class InlineAliases implements CompilerPass {
this.compiler = compiler;
}

private boolean shouldInlineAliases() {
if (compiler.getOptions().processCommonJSModules) {
// TODO(blickly): Remove this case once CommonJS modules are rewritten like goog.modules.
return true;
}
if (J2clSourceFileChecker.shouldSkipExecution(compiler)) {
return false;
}
return true;
}

@Override
public void process(Node externs, Node root) {
if (shouldInlineAliases()) {
namespace = new GlobalNamespace(compiler, root);
NodeTraversal.traverseEs6(compiler, root, new AliasesCollector());
NodeTraversal.traverseEs6(compiler, root, new AliasesInliner());
}
namespace = new GlobalNamespace(compiler, root);
NodeTraversal.traverseEs6(compiler, root, new AliasesCollector());
NodeTraversal.traverseEs6(compiler, root, new AliasesInliner());
}

private class AliasesCollector extends AbstractPostOrderCallback {
Expand Down

0 comments on commit ee43373

Please sign in to comment.