public final class FeatureSet extends Object implements Serializable
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.
Modifier and Type | Class and Description |
---|---|
static class |
FeatureSet.Feature
Specific features that can be included in a FeatureSet.
|
Modifier and Type | Field and Description |
---|---|
static FeatureSet |
BARE_MINIMUM
The bare minimum set of features.
|
static FeatureSet |
ES3
Features from ES3.
|
static FeatureSet |
ES5
Features from ES5 only.
|
static FeatureSet |
ES6
The full set of ES6 features, not including modules.
|
static FeatureSet |
ES6_MODULES
All ES6 features, including modules.
|
static FeatureSet |
ES7 |
static FeatureSet |
ES7_MODULES |
static FeatureSet |
ES8 |
static FeatureSet |
ES8_MODULES |
static FeatureSet |
TYPESCRIPT |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(FeatureSet other)
Does this
FeatureSet contain all of the features of other ? |
boolean |
equals(Object other) |
boolean |
has(FeatureSet.Feature feature)
Does this
FeatureSet include feature ? |
int |
hashCode() |
static FeatureSet |
latest() |
String |
toString() |
FeatureSet |
union(FeatureSet other)
|
static FeatureSet |
valueOf(String name)
Parses known strings into feature sets.
|
String |
version()
Returns a string representation suitable for encoding in depgraph and deps.js files.
|
FeatureSet |
with(FeatureSet.Feature... newFeatures)
Returns a feature set combining all the features from
this and newFeatures . |
FeatureSet |
with(Set<FeatureSet.Feature> newFeatures)
Returns a feature set combining all the features from
this and newFeatures . |
FeatureSet |
without(FeatureSet.Feature feature) |
FeatureSet |
withoutTypes() |
public static final FeatureSet BARE_MINIMUM
public static final FeatureSet ES3
public static final FeatureSet ES5
public static final FeatureSet ES6_MODULES
public static final FeatureSet ES6
public static final FeatureSet ES7_MODULES
public static final FeatureSet ES7
public static final FeatureSet ES8_MODULES
public static final FeatureSet ES8
public static final FeatureSet TYPESCRIPT
public String version()
public FeatureSet without(FeatureSet.Feature feature)
public FeatureSet withoutTypes()
public FeatureSet union(FeatureSet other)
public boolean contains(FeatureSet other)
FeatureSet
contain all of the features of other
?public FeatureSet with(FeatureSet.Feature... newFeatures)
this
and newFeatures
.public FeatureSet with(Set<FeatureSet.Feature> newFeatures)
this
and newFeatures
.public boolean has(FeatureSet.Feature feature)
FeatureSet
include feature
?public static FeatureSet valueOf(String name)
public static FeatureSet latest()
Copyright © 2009-2017 Google. All Rights Reserved.