Package com.google.javascript.jscomp
Class DestructuredTarget
java.lang.Object
com.google.javascript.jscomp.DestructuredTarget
Represents a single target inside a destructuring pattern, whether another pattern or a lhs
expression.
Call inferType
to do type inference on the target lazily. This class is designed so
that a caller can get information about a target, use that information to do additional type
inference, and finally call inferType
if desired.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.collect.ImmutableList
<DestructuredTarget> createAllNonEmptyTargetsInPattern
(JSTypeRegistry registry, com.google.common.base.Supplier<JSType> patternType, Node pattern) Returns all the targets directly in the given pattern, except for EMPTY nodesstatic com.google.common.collect.ImmutableList
<DestructuredTarget> createAllNonEmptyTargetsInPattern
(JSTypeRegistry registry, JSType patternType, Node pattern) Returns all the targets directly in the given pattern, except for EMPTY nodes@Nullable Node
Returns a COMPUTED_PROP node or null@Nullable Node
getNode()
@Nullable Node
Returns a STRING_KEY node or nullboolean
boolean
boolean
-
Method Details
-
getComputedProperty
Returns a COMPUTED_PROP node or null -
hasComputedProperty
public boolean hasComputedProperty() -
hasStringKey
public boolean hasStringKey() -
getStringKey
Returns a STRING_KEY node or null -
getDefaultValue
-
hasDefaultValue
public boolean hasDefaultValue() -
getNode
-
createAllNonEmptyTargetsInPattern
public static com.google.common.collect.ImmutableList<DestructuredTarget> createAllNonEmptyTargetsInPattern(JSTypeRegistry registry, JSType patternType, Node pattern) Returns all the targets directly in the given pattern, except for EMPTY nodesEMPTY nodes occur in array patterns with elisions, e.g. `[, , a] = []`
-
createAllNonEmptyTargetsInPattern
public static com.google.common.collect.ImmutableList<DestructuredTarget> createAllNonEmptyTargetsInPattern(JSTypeRegistry registry, com.google.common.base.Supplier<JSType> patternType, Node pattern) Returns all the targets directly in the given pattern, except for EMPTY nodesEMPTY nodes occur in array patterns with elisions, e.g. `[, , a] = []`
-