Skip to content

Commit

Permalink
Move async function transpilation after all checks.
Browse files Browse the repository at this point in the history
See #2540

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=222265244
  • Loading branch information
brad4d authored and lauraharker committed Nov 21, 2018
1 parent bbe22e5 commit 4b6d65e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/com/google/javascript/jscomp/TranspilationPasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ static void addPreTypecheckTranspilationPasses(
passes.add(rewriteObjectSpread);
}

if (options.needsTranspilationFrom(ES8)) {
// Trailing commas in parameter lists are flagged as present by the parser,
// but never actually represented in the AST.
// The only thing we need to do is mark them as not present in the AST.
passes.add(
createFeatureRemovalPass(
"markTrailingCommasInParameterListsRemoved", Feature.TRAILING_COMMA_IN_PARAM_LIST));
passes.add(rewriteAsyncFunctions);
}
if (options.needsTranspilationFrom(ES6) && doEs6ExternsCheck) {
passes.add(es6ExternsCheck);
}
Expand All @@ -111,6 +102,16 @@ public static void addEs6RewriteImportPathPass(List<PassFactory> passes) {
/** Adds transpilation passes that should run after all checks are done. */
public static void addPostCheckTranspilationPasses(
List<PassFactory> passes, CompilerOptions options) {
if (options.needsTranspilationFrom(ES8)) {
// Trailing commas in parameter lists are flagged as present by the parser,
// but never actually represented in the AST.
// The only thing we need to do is mark them as not present in the AST.
passes.add(
createFeatureRemovalPass(
"markTrailingCommasInParameterListsRemoved", Feature.TRAILING_COMMA_IN_PARAM_LIST));
passes.add(rewriteAsyncFunctions);
}

if (options.needsTranspilationFrom(ES7)) {
passes.add(rewriteExponentialOperator);
}
Expand Down

0 comments on commit 4b6d65e

Please sign in to comment.