Class FeatureSet
java.lang.Object
com.google.javascript.jscomp.parsing.parser.FeatureSet
- All Implemented Interfaces:
Serializable
Represents various aspects of language version and support.
This is somewhat redundant with LanguageMode, but is separate for two reasons: (1) it's used for parsing, which cannot depend on LanguageMode, and (2) it's concerned with slightly different nuances: implemented features and modules rather than strictness.
In the long term, it would be good to disentangle all these concerns and pull out a single LanguageSyntax enum with a separate strict mode flag, and then these could possibly be unified.
Instances of this class are immutable.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecific features that can be included in a FeatureSet. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FeatureSetstatic final FeatureSetThe bare minimum set of features.static final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetThe full set of ES2015 features, not including modules.static final FeatureSetAll ES2015 features, including modules.static final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetstatic final FeatureSetFeatures from ES3.static final FeatureSetFeatures from ES5 only. -
Method Summary
Modifier and TypeMethodDescriptionstatic FeatureSetall()Returns aFeatureSetcontaining all known features.booleancontains(FeatureSet other) Does thisFeatureSetcontain all of the features ofother?booleancontains(FeatureSet.Feature feature) Does thisFeatureSetcontain the given feature?booleancontainsAtLeastOneOf(FeatureSet other) Does thisFeatureSetcontain at least one of the features ofother?booleancom.google.common.collect.ImmutableSet<FeatureSet.Feature> booleanhas(FeatureSet.Feature feature) Does thisFeatureSetincludefeature?inthashCode()static FeatureSetlatest()toString()union(FeatureSet other) static FeatureSetParses known strings into feature sets.version()Returns a string representation suitable for use in polyfill definition files and encoding in depgraph and deps.js files.Deprecated.with(FeatureSet newFeatures) Returns a feature set combining all the features fromthisandnewFeatures.with(FeatureSet.Feature feature) Returns a feature set combining all the features fromthisandfeature.with(FeatureSet.Feature... newFeatures) Returns a feature set combining all the features fromthisandnewFeatures.with(Set<FeatureSet.Feature> newFeatures) Returns a feature set combining all the features fromthisandnewFeatures.without(FeatureSet other) without(FeatureSet.Feature featureToRemove, FeatureSet.Feature... moreFeaturesToRemove)
-
Field Details
-
BARE_MINIMUM
The bare minimum set of features. -
ES3
Features from ES3. -
ES5
Features from ES5 only. -
ES2015_MODULES
All ES2015 features, including modules. -
ES2015
The full set of ES2015 features, not including modules. -
ES2016_MODULES
-
ES2016
-
ES2017_MODULES
-
ES2017
-
ES2018_MODULES
-
ES2018
-
ES2019_MODULES
-
ES2019
-
ES2020_MODULES
-
ES2020
-
ES2021_MODULES
-
ES2021
-
ES_NEXT
-
ES_UNSTABLE
-
ES_UNSUPPORTED
-
BROWSER_2020
-
BROWSER_2021
-
BROWSER_2022
-
BROWSER_2023
-
BROWSER_2024
-
BROWSER_2025
-
ALL
-
-
Method Details
-
version
Returns a string representation suitable for use in polyfill definition files and encoding in depgraph and deps.js files. -
versionForDebugging
Deprecated.Please useversion()instead.Returns a string representation useful for debugging. -
without
public FeatureSet without(FeatureSet.Feature featureToRemove, FeatureSet.Feature... moreFeaturesToRemove) -
without
-
withoutTypes
-
union
-
containsAtLeastOneOf
Does thisFeatureSetcontain at least one of the features ofother? -
contains
Does thisFeatureSetcontain all of the features ofother? -
contains
Does thisFeatureSetcontain the given feature? -
with
Returns a feature set combining all the features fromthisandfeature. -
with
Returns a feature set combining all the features fromthisandnewFeatures. -
with
Returns a feature set combining all the features fromthisandnewFeatures. -
with
Returns a feature set combining all the features fromthisandnewFeatures. -
has
Does thisFeatureSetincludefeature? -
getFeatures
-
equals
-
hashCode
public int hashCode() -
toString
-
valueOf
Parses known strings into feature sets. -
all
Returns aFeatureSetcontaining all known features.NOTE:
PassFactoryclasses that claim to supportFeatureSet.all()should be only those that cannot be broken by new features being added to the language. Mainly these are passes that don't have to actually look at the AST at all, like empty marker passes. -
latest
-
version()instead.