Move the transpilation of public class fields to the correct place in the transpilation order.
@@ -74,6 +74,14 @@ public class TranspilationPasses {
// Note that, for features >ES2017 we detect feature by feature rather than by yearly languages
// in order to handle FeatureSet.BROWSER_2020, which is ES2019 without the new RegExp features.
+ // However, RegExp features are not transpiled, and this does not imply that we allow arbitrary
+ // selection of features to transpile. They still must be done in chronological order based on.
+ // This greatly simplifies testing and the requirements for the transpilation passes.
+
+ if (options.needsTranspilationOf(Feature.PUBLIC_CLASS_FIELDS)) {
+ passes.add(rewriteClassFields);
+ }
+
if (options.needsTranspilationOf(Feature.NUMERIC_SEPARATOR)) {
// Numeric separators are flagged as present by the parser,
// but never actually represented in the AST.
@@ -121,10 +129,6 @@ public class TranspilationPasses {
passes.add(rewriteExponentialOperator);
}
- if (options.needsTranspilationOf(Feature.PUBLIC_CLASS_FIELDS)) {
- passes.add(rewriteClassFields);
- }
-
if (options.needsTranspilationFrom(ES2015)) {
// Binary and octal literals are effectively transpiled by the parser.
// There's no transpilation we can do for the new regexp flags.
