Commit f465cd7 1 parent f51970c commit f465cd7 Copy full SHA for f465cd7
File tree 3 files changed +13
-0
lines changed
src/com/google/javascript/jscomp
test/com/google/javascript/jscomp
3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ void setDependentValuesFromYear(CompilerOptions options) {
183
183
options .languageOutIsDefaultStrict = Optional .of (true );
184
184
options .setDefineToNumberLiteral ("goog.FEATURESET_YEAR" , year );
185
185
options .setDefineToBooleanLiteral ("$jscomp.ASSUME_ES5" , year > 2012 );
186
+ options .setDefineToBooleanLiteral ("$jscomp.ASSUME_ES6" , year > 2018 );
186
187
}
187
188
188
189
FeatureSet getFeatureSet () {
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ class ProcessDefines implements CompilerPass {
59
59
"COMPILED" ,
60
60
"goog.DEBUG" ,
61
61
"$jscomp.ASSUME_ES5" ,
62
+ "$jscomp.ASSUME_ES6" ,
62
63
"$jscomp.ISOLATE_POLYFILLS" ,
63
64
"$jscomp.INSTRUMENT_ASYNC_CONTEXT" );
64
65
Original file line number Diff line number Diff line change @@ -75,6 +75,17 @@ public void testBrowserFeaturesetYearOptionSetsAssumeES5() {
75
75
.isEqualTo (Token .TRUE );
76
76
}
77
77
78
+ @ Test
79
+ public void testBrowserFeaturesetYearOptionSetsAssumeES6 () {
80
+ CompilerOptions options = new CompilerOptions ();
81
+ options .setBrowserFeaturesetYear (2018 );
82
+ assertThat (options .getDefineReplacements ().get ("$jscomp.ASSUME_ES6" ).getToken ())
83
+ .isEqualTo (Token .FALSE );
84
+ options .setBrowserFeaturesetYear (2019 );
85
+ assertThat (options .getDefineReplacements ().get ("$jscomp.ASSUME_ES6" ).getToken ())
86
+ .isEqualTo (Token .TRUE );
87
+ }
88
+
78
89
@ Test
79
90
public void testMinimumBrowserFeatureSetYearRequiredFor () {
80
91
assertThat (BrowserFeaturesetYear .minimumRequiredFor (Feature .GETTER ))
You can’t perform that action at this time.
0 commit comments