Skip to content

Commit

Permalink
Roll back of "(Take 2) Moves J2CL pass to run before ES6 generator re…
Browse files Browse the repository at this point in the history
…-writing."

Reason: Interacts badly with the class tranpilation move. The J2CL pass is not compatible with ES6 classes and needs to run after transpilation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214015438
  • Loading branch information
concavelenz authored and tjgq committed Sep 22, 2018
1 parent 5180a3a commit 19ce34e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
13 changes: 3 additions & 10 deletions src/com/google/javascript/jscomp/DefaultPassConfig.java
Expand Up @@ -462,10 +462,6 @@ protected List<PassFactory> getChecks() {

checks.add(createEmptyPass(PassNames.AFTER_STANDARD_CHECKS));

if (!options.checksOnly && options.j2clPassMode.shouldAddJ2clPasses()) {
checks.add(j2clPass);
}

if (!options.checksOnly) {
// At this point all checks have been done.
// There's no need to complete transpilation if we're only running checks.
Expand Down Expand Up @@ -522,7 +518,10 @@ protected List<PassFactory> getOptimizations() {
// optimizing passes.
passes.add(gatherExternProperties);

// Should be run before runtimeTypeCheck and instrumentForCoverage as they rewrite code that
// this pass expects to see.
if (options.j2clPassMode.shouldAddJ2clPasses()) {
passes.add(j2clPass);
passes.add(j2clUtilGetDefineRewriterPass);
}

Expand Down Expand Up @@ -1112,12 +1111,6 @@ private void assertValidOrderForChecks(List<PassFactory> checks) {
removeSuperMethodsPass,
"Super-call method removal must run after closure code removal, because "
+ "removing assertions may make more super calls eligible to be stripped.");

assertPassOrder(
checks,
j2clPass,
TranspilationPasses.rewriteGenerators,
"J2CL normalization should be done before generator re-writing.");
}

/**
Expand Down
8 changes: 0 additions & 8 deletions src/com/google/javascript/jscomp/FunctionInjector.java
Expand Up @@ -272,14 +272,6 @@ public boolean apply(Node input) {
*/
Node inline(Reference ref, String fnName, Node fnNode) {
checkState(compiler.getLifeCycleStage().isNormalized());
return unsafeInline(ref, fnName, fnNode);
}

/**
* Inline a function into the call site. Note that this unsafe version doesn't verify if the AST
* is normalized. You should use {@link inline} instead.
*/
Node unsafeInline(Reference ref, String fnName, Node fnNode) {
Node result;
if (ref.mode == InliningMode.DIRECT) {
result = inlineReturnValue(ref, fnNode);
Expand Down
2 changes: 1 addition & 1 deletion src/com/google/javascript/jscomp/J2clPass.java
Expand Up @@ -185,7 +185,7 @@ public void visit(NodeTraversal t, Node n, Node parent) {

// Otherwise inline the call.
Node inlinedCall =
injector.unsafeInline(
injector.inline(
new Reference(n, t.getScope(), t.getModule(), inliningMode), fnName, fnImpl);
t.getCompiler().reportChangeToEnclosingScope(inlinedCall);
}
Expand Down

0 comments on commit 19ce34e

Please sign in to comment.