Skip to content

Commit

Permalink
A completely new implementation of Es6RewriteGenerators. It aims to g…
Browse files Browse the repository at this point in the history
…enerate correct code with less boilerplate and supporting a wider range of features.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187091342
  • Loading branch information
SergejSalnikov authored and Tyler Breisacher committed Feb 27, 2018
1 parent 4b3b2b3 commit ac40591
Show file tree
Hide file tree
Showing 10 changed files with 2,288 additions and 2,340 deletions.
14 changes: 3 additions & 11 deletions src/com/google/javascript/jscomp/EarlyEs6ToEs3Converter.java
Expand Up @@ -89,12 +89,6 @@ public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
// but we want the runtime functions to be have TypeI applied to it by the type checker.
Es6ToEs3Util.preloadEs6RuntimeFunction(compiler, "makeIterator");
break;
case YIELD:
if (n.isYieldAll()) {
Es6ToEs3Util.preloadEs6RuntimeFunction(compiler, "makeIterator");
}
Es6ToEs3Util.preloadEs6Symbol(compiler);
break;
case GETTER_DEF:
case SETTER_DEF:
if (compiler.getOptions().getLanguageOut() == LanguageMode.ECMASCRIPT3) {
Expand All @@ -107,6 +101,9 @@ public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
if (n.isAsyncFunction()) {
throw new IllegalStateException("async functions should have already been converted");
}
if (n.isGeneratorFunction()) {
compiler.ensureLibraryInjected("es6/generator_engine", /* force= */ false);
}
break;
default:
break;
Expand Down Expand Up @@ -137,11 +134,6 @@ public void visit(NodeTraversal t, Node n, Node parent) {
}
}
break;
case FUNCTION:
if (n.isGeneratorFunction()) {
Es6RewriteGenerators.preloadGeneratorSkeletonAndReportChange(compiler);
}
break;
default:
break;
}
Expand Down

0 comments on commit ac40591

Please sign in to comment.