Use an EnumSet instead of an ArrayList when serializing Node props
@@ -29,7 +29,7 @@ import com.google.javascript.rhino.RhinoStringPool;
import com.google.javascript.rhino.StaticSourceFile;
import com.google.javascript.rhino.jstype.JSType;
import com.google.javascript.rhino.serialization.SerializationOptions;
-import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.IdentityHashMap;
/** Transforms a compiler AST into a serialized TypedAst object. */
@@ -140,8 +140,8 @@ final class TypedAstSerializer {
return builder.build();
}
- private ArrayList<NodeProperty> booleanPropTranslator(Node n) {
- ArrayList<NodeProperty> props = new ArrayList<>();
+ private EnumSet<NodeProperty> booleanPropTranslator(Node n) {
+ EnumSet<NodeProperty> props = EnumSet.noneOf(NodeProperty.class);
if (n.isArrowFunction()) {
props.add(NodeProperty.ARROW_FN);
}
