Skip to content

Commit

Permalink
Reorder ES_2018 and ES_NEXT FeatureSets and move object rest/spread i…
Browse files Browse the repository at this point in the history
…nto ES Next

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202687268
  • Loading branch information
MatthewMerrill authored and lauraharker committed Jul 2, 2018
1 parent a4d3536 commit 7fa1896
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/com/google/javascript/jscomp/TranspilationPasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.javascript.jscomp;

import static com.google.javascript.jscomp.parsing.parser.FeatureSet.ES2018;
import static com.google.javascript.jscomp.parsing.parser.FeatureSet.ES6;
import static com.google.javascript.jscomp.parsing.parser.FeatureSet.ES7;
import static com.google.javascript.jscomp.parsing.parser.FeatureSet.ES8;
Expand Down Expand Up @@ -73,7 +72,7 @@ public static void addPreTypecheckTranspilationPasses(
// parameter can be removed.
static void addPreTypecheckTranspilationPasses(
List<PassFactory> passes, CompilerOptions options, boolean doEs6ExternsCheck) {
if (options.needsTranspilationFrom(ES2018)) {
if (options.needsTranspilationFrom(ES_NEXT)) {
passes.add(rewriteObjRestSpread);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ public final class FeatureSet implements Serializable {

public static final FeatureSet ES8 = ES8_MODULES.without(Feature.MODULES);

public static final FeatureSet ES2018_MODULES = ES8_MODULES.with(LangVersion.ES2018.features());
public static final FeatureSet ES_NEXT = ES8_MODULES.with(LangVersion.ES_NEXT.features());

public static final FeatureSet ES2018_MODULES = ES_NEXT.with(LangVersion.ES2018.features());

public static final FeatureSet ES2018 = ES2018_MODULES.without(Feature.MODULES);

public static final FeatureSet ES_NEXT = ES2018_MODULES.with(LangVersion.ES_NEXT.features());

public static final FeatureSet TYPESCRIPT = ES_NEXT.with(LangVersion.TYPESCRIPT.features());

Expand Down Expand Up @@ -149,8 +150,8 @@ public enum Feature {
TRAILING_COMMA_IN_PARAM_LIST("trailing comma in param list", LangVersion.ES8),

// ES 2018 adds https://github.com/tc39/proposal-object-rest-spread
OBJECT_LITERALS_WITH_SPREAD("object literals with spread", LangVersion.ES2018),
OBJECT_PATTERN_REST("object pattern rest", LangVersion.ES2018),
OBJECT_LITERALS_WITH_SPREAD("object literals with spread", LangVersion.ES_NEXT),
OBJECT_PATTERN_REST("object pattern rest", LangVersion.ES_NEXT),

// ES6 typed features that are not at all implemented in browsers
ACCESSIBILITY_MODIFIER("accessibility modifier", LangVersion.TYPESCRIPT),
Expand Down
2 changes: 1 addition & 1 deletion test/com/google/javascript/jscomp/IntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5213,7 +5213,7 @@ public void testDestructuringCannotConvert() {

public void testDestructuringRest() {
CompilerOptions options = createCompilerOptions();
options.setLanguageIn(LanguageMode.ECMASCRIPT_2018);
options.setLanguageIn(LanguageMode.ECMASCRIPT_NEXT);
options.setLanguageOut(LanguageMode.ECMASCRIPT_2017);

test(options, "const {y} = {}", "const {y} = {}");
Expand Down

0 comments on commit 7fa1896

Please sign in to comment.