Skip to content

Commit

Permalink
Rollback "Moves J2CL pass to run before ES6 generator re-writing."
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194097002
  • Loading branch information
aljimenez authored and brad4d committed Apr 24, 2018
1 parent d00bfd7 commit ef4acee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
10 changes: 6 additions & 4 deletions src/com/google/javascript/jscomp/DefaultPassConfig.java
Expand Up @@ -487,10 +487,6 @@ protected List<PassFactory> getChecks() {

if (options.j2clPassMode.shouldAddJ2clPasses()) {
checks.add(j2clChecksPass);
// Needs to run before generator re-writing.
checks.add(j2clPass);
// Needs to run after processDefines
checks.add(j2clUtilGetDefineRewriterPass);
}

if (options.shouldRunTypeSummaryChecksLate()) {
Expand Down Expand Up @@ -583,6 +579,12 @@ protected List<PassFactory> getOptimizations() {
passes.add(instrumentForCodeCoverage);
}

// Should be run before runtimeTypeCheck.
if (options.j2clPassMode.shouldAddJ2clPasses()) {
passes.add(j2clPass);
passes.add(j2clUtilGetDefineRewriterPass);
}

// TODO(dimvar): convert this pass to use NTI. Low priority since it's
// mostly unused. Converting it shouldn't block switching to NTI.
if (options.runtimeTypeCheck && !options.getNewTypeInference()) {
Expand Down
8 changes: 0 additions & 8 deletions src/com/google/javascript/jscomp/FunctionInjector.java
Expand Up @@ -270,14 +270,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 ef4acee

Please sign in to comment.