Skip to content

Commit

Permalink
Automated g4 rollback of changelist 164281442.
Browse files Browse the repository at this point in the history
*** Original change description ***

Separated Es6ToEs3Converter into two passes, one intended to run before NTI and the other
after. Currently both passes still run before NTI.

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164306218
  • Loading branch information
EatingW authored and dimvar committed Aug 4, 2017
1 parent 775c334 commit ec39d4f
Show file tree
Hide file tree
Showing 19 changed files with 270 additions and 425 deletions.
4 changes: 1 addition & 3 deletions src/com/google/javascript/jscomp/DefaultPassConfig.java
Expand Up @@ -184,7 +184,6 @@ protected List<PassFactory> getTranspileOnlyPasses() {
if (options.needsTranspilationFrom(ES6) || options.needsTranspilationFrom(ES7)) { if (options.needsTranspilationFrom(ES6) || options.needsTranspilationFrom(ES7)) {
TranspilationPasses.addEs6EarlyPasses(passes); TranspilationPasses.addEs6EarlyPasses(passes);
TranspilationPasses.addEs6LatePasses(passes); TranspilationPasses.addEs6LatePasses(passes);
TranspilationPasses.addEs6PassesAfterNTI(passes);
TranspilationPasses.addPostCheckPasses(passes); TranspilationPasses.addPostCheckPasses(passes);
if (options.rewritePolyfills) { if (options.rewritePolyfills) {
TranspilationPasses.addRewritePolyfillPass(passes); TranspilationPasses.addRewritePolyfillPass(passes);
Expand Down Expand Up @@ -374,7 +373,6 @@ protected List<PassFactory> getChecks() {


if (options.needsTranspilationFrom(ES6)) { if (options.needsTranspilationFrom(ES6)) {
TranspilationPasses.addEs6LatePasses(checks); TranspilationPasses.addEs6LatePasses(checks);
TranspilationPasses.addEs6PassesAfterNTI(checks);
if (options.rewritePolyfills) { if (options.rewritePolyfills) {
TranspilationPasses.addRewritePolyfillPass(checks); TranspilationPasses.addRewritePolyfillPass(checks);
} }
Expand All @@ -391,7 +389,7 @@ protected List<PassFactory> getChecks() {
checks.add(convertStaticInheritance); checks.add(convertStaticInheritance);
} }


// End of ES6 transpilation passes before NTI. // End of ES6 transpilation passes.


if (!options.skipNonTranspilationPasses) { if (!options.skipNonTranspilationPasses) {
addNonTranspilationCheckPasses(checks); addNonTranspilationCheckPasses(checks);
Expand Down
4 changes: 2 additions & 2 deletions src/com/google/javascript/jscomp/Es6ConvertSuper.java
Expand Up @@ -16,7 +16,7 @@
package com.google.javascript.jscomp; package com.google.javascript.jscomp;


import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
import static com.google.javascript.jscomp.Es6ToEs3Util.CANNOT_CONVERT_YET; import static com.google.javascript.jscomp.Es6ToEs3Converter.CANNOT_CONVERT_YET;


import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
Expand All @@ -30,7 +30,7 @@
/** /**
* Converts {@code super.method()} calls and adds constructors to any classes that lack them. * Converts {@code super.method()} calls and adds constructors to any classes that lack them.
* *
* <p>This has to run before the main {@link Es6RewriteClass} pass. The super() constructor calls * <p>This has to run before the main {@link Es6ToEs3Converter} pass. The super() constructor calls
* are not converted here, but rather in {@link Es6ConvertSuperConstructorCalls}, which runs later. * are not converted here, but rather in {@link Es6ConvertSuperConstructorCalls}, which runs later.
*/ */
public final class Es6ConvertSuper extends NodeTraversal.AbstractPostOrderCallback public final class Es6ConvertSuper extends NodeTraversal.AbstractPostOrderCallback
Expand Down
Expand Up @@ -18,7 +18,7 @@
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
import static com.google.javascript.jscomp.Es6ToEs3Util.CANNOT_CONVERT; import static com.google.javascript.jscomp.Es6ToEs3Converter.CANNOT_CONVERT;


import com.google.javascript.jscomp.GlobalNamespace.Name; import com.google.javascript.jscomp.GlobalNamespace.Name;
import com.google.javascript.jscomp.GlobalNamespace.Ref; import com.google.javascript.jscomp.GlobalNamespace.Ref;
Expand Down
4 changes: 2 additions & 2 deletions src/com/google/javascript/jscomp/Es6ExtractClasses.java
Expand Up @@ -17,7 +17,7 @@
package com.google.javascript.jscomp; package com.google.javascript.jscomp;


import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.javascript.jscomp.Es6ToEs3Util.CANNOT_CONVERT; import static com.google.javascript.jscomp.Es6ToEs3Converter.CANNOT_CONVERT;


import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType; import com.google.javascript.jscomp.ExpressionDecomposer.DecompositionType;
import com.google.javascript.jscomp.deps.ModuleNames; import com.google.javascript.jscomp.deps.ModuleNames;
Expand All @@ -42,7 +42,7 @@
* foo($jscomp$classdecl$var0); * foo($jscomp$classdecl$var0);
* </code> * </code>
* <p> * <p>
* This must be done before {@link Es6RewriteClass}, because that pass only handles classes * This must be done before {@link Es6ToEs3Converter}, because that pass only handles classes
* that are declarations or simple assignments. * that are declarations or simple assignments.
* @see Es6RewriteClass#visitClass(NodeTraversal, Node, Node) * @see Es6RewriteClass#visitClass(NodeTraversal, Node, Node)
*/ */
Expand Down
4 changes: 2 additions & 2 deletions src/com/google/javascript/jscomp/Es6RewriteClass.java
Expand Up @@ -17,8 +17,8 @@


import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
import static com.google.javascript.jscomp.Es6ToEs3Util.CANNOT_CONVERT; import static com.google.javascript.jscomp.Es6ToEs3Converter.CANNOT_CONVERT;
import static com.google.javascript.jscomp.Es6ToEs3Util.CANNOT_CONVERT_YET; import static com.google.javascript.jscomp.Es6ToEs3Converter.CANNOT_CONVERT_YET;


import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
Expand Down
Expand Up @@ -17,7 +17,7 @@


import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
import static com.google.javascript.jscomp.Es6ToEs3Util.makeIterator; import static com.google.javascript.jscomp.Es6ToEs3Converter.makeIterator;


import com.google.javascript.rhino.IR; import com.google.javascript.rhino.IR;
import com.google.javascript.rhino.JSDocInfo; import com.google.javascript.rhino.JSDocInfo;
Expand Down
10 changes: 5 additions & 5 deletions src/com/google/javascript/jscomp/Es6RewriteGenerators.java
Expand Up @@ -17,7 +17,7 @@


import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
import static com.google.javascript.jscomp.Es6ToEs3Util.makeIterator; import static com.google.javascript.jscomp.Es6ToEs3Converter.makeIterator;


import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
Expand Down Expand Up @@ -513,7 +513,7 @@ private void visitBreak() {
compiler.report( compiler.report(
JSError.make( JSError.make(
currentStatement, currentStatement,
Es6ToEs3Util.CANNOT_CONVERT_YET, Es6ToEs3Converter.CANNOT_CONVERT_YET,
"Breaking to a label that is not a loop")); "Breaking to a label that is not a loop"));
return; return;
} }
Expand Down Expand Up @@ -637,7 +637,7 @@ private void visitSwitch() {
compiler.report( compiler.report(
JSError.make( JSError.make(
currentStatement, currentStatement,
Es6ToEs3Util.CANNOT_CONVERT_YET, Es6ToEs3Converter.CANNOT_CONVERT_YET,
"Default case as intermediate case")); "Default case as intermediate case"));
} }
equivBlock = IR.block(currCase.removeFirstChild()); equivBlock = IR.block(currCase.removeFirstChild());
Expand Down Expand Up @@ -1006,7 +1006,7 @@ public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
compiler.report( compiler.report(
JSError.make( JSError.make(
n, n,
Es6ToEs3Util.CANNOT_CONVERT_YET, Es6ToEs3Converter.CANNOT_CONVERT_YET,
"Case statements that contain yields")); "Case statements that contain yields"));
return false; return false;
} }
Expand All @@ -1027,7 +1027,7 @@ private void visitYieldExpression(NodeTraversal t, Node n) {
t.reportCodeChange(); t.reportCodeChange();
} else { } else {
compiler.report( compiler.report(
JSError.make(n, Es6ToEs3Util.CANNOT_CONVERT, "Undecomposable expression")); JSError.make(n, Es6ToEs3Converter.CANNOT_CONVERT, "Undecomposable expression"));
} }
} }


Expand Down
2 changes: 1 addition & 1 deletion src/com/google/javascript/jscomp/Es6RewriteModules.java
Expand Up @@ -324,7 +324,7 @@ private void visitExport(NodeTraversal t, Node export, Node parent) {
} }
} else if (export.getBooleanProp(Node.EXPORT_ALL_FROM)) { } else if (export.getBooleanProp(Node.EXPORT_ALL_FROM)) {
// export * from 'moduleIdentifier'; // export * from 'moduleIdentifier';
compiler.report(JSError.make(export, Es6ToEs3Util.CANNOT_CONVERT_YET, compiler.report(JSError.make(export, Es6ToEs3Converter.CANNOT_CONVERT_YET,
"Wildcard export")); "Wildcard export"));
} else if (export.hasTwoChildren()) { } else if (export.hasTwoChildren()) {
// export {x, y as z} from 'moduleIdentifier'; // export {x, y as z} from 'moduleIdentifier';
Expand Down

0 comments on commit ec39d4f

Please sign in to comment.