public final class FeatureSet
extends java.lang.Object
implements java.io.Serializable
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.
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.
|
private boolean |
es6Modules
Whether ES6 modules are included.
|
private int |
number
The number of the language version: 3, 5, or 6.
|
private boolean |
typeScript
Whether TypeScript syntax is included (for .d.ts support).
|
static FeatureSet |
TYPESCRIPT
TypeScript syntax.
|
private boolean |
unsupported
Whether this includes features not supported in current stable browsers.
|
Modifier | Constructor and Description |
---|---|
private |
FeatureSet(int number,
boolean unsupported,
boolean es6Modules,
boolean typeScript) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.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 . |
java.lang.String |
toLanguageModeString()
Returns a the name of a corresponding LanguageMode enum element.
|
java.lang.String |
toString() |
java.lang.String |
version()
Returns a string representation suitable for encoding in depgraph and deps.js files.
|
private final int number
private final boolean unsupported
private final boolean es6Modules
private final boolean typeScript
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 TYPESCRIPT
private FeatureSet(int number, boolean unsupported, boolean es6Modules, boolean typeScript)
public java.lang.String version()
public boolean hasEs6Modules()
public boolean isTypeScript()
public FeatureSet require(FeatureSet other)
this
and other
.public FeatureSet require(FeatureSet.Feature feature)
this
and feature
.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toLanguageModeString()