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 (indirectly) in a FeatureSet.
|
Modifier and Type | Field and Description |
---|---|
static FeatureSet |
ES3
The bare minimum set of features in ES3.
|
static FeatureSet |
ES5
Features from ES5 only.
|
static FeatureSet |
ES6
The full set of ES6 features, not including modules.
|
static FeatureSet |
ES6_IMPL
The subset of ES6 features that are implemented in stable Chrome, Firefox, and Edge.
|
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
TypeScript syntax.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(FeatureSet.Feature feature)
Does this
FeatureSet include feature ? |
boolean |
contains(FeatureSet other)
Does this
FeatureSet contain all of the features of other ? |
boolean |
equals(Object other) |
boolean |
hasEs6Modules()
Returns whether this feature set includes ES6 modules.
|
int |
hashCode() |
boolean |
isTypeScript()
Returns whether this feature set includes typescript features.
|
FeatureSet |
require(FeatureSet.Feature feature)
Returns a feature set combining all the features from
this and feature . |
FeatureSet |
require(FeatureSet other)
Returns a feature set combining all the features from
this and other . |
String |
toLanguageModeString()
Returns a the name of a corresponding LanguageMode enum element.
|
String |
toString() |
FeatureSet |
union(FeatureSet other)
|
String |
version()
Returns a string representation suitable for encoding in depgraph and deps.js files.
|
public static final FeatureSet ES3
public static final FeatureSet ES5
public static final FeatureSet ES6_IMPL
public static final FeatureSet ES6
public static final FeatureSet ES6_MODULES
public static final FeatureSet ES7
public static final FeatureSet ES7_MODULES
public static final FeatureSet ES8
public static final FeatureSet ES8_MODULES
public static final FeatureSet TYPESCRIPT
public String version()
public boolean hasEs6Modules()
public boolean isTypeScript()
public FeatureSet require(FeatureSet other)
this
and other
.public FeatureSet union(FeatureSet other)
public boolean contains(FeatureSet other)
FeatureSet
contain all of the features of other
?public FeatureSet require(FeatureSet.Feature feature)
this
and feature
.public boolean contains(FeatureSet.Feature feature)
FeatureSet
include feature
?public String toLanguageModeString()
Copyright © 2009-2016 Google. All Rights Reserved.