Package com.google.javascript.jscomp
Class DestructuredTarget
- java.lang.Object
-
- com.google.javascript.jscomp.DestructuredTarget
-
public final class DestructuredTarget extends java.lang.Object
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 callinferType
if desired.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 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
getComputedProperty()
Returns a COMPUTED_PROP node or null@Nullable Node
getDefaultValue()
Node
getNode()
@Nullable Node
getStringKey()
Returns a STRING_KEY node or nullboolean
hasComputedProperty()
boolean
hasDefaultValue()
boolean
hasStringKey()
-
-
-
Method Detail
-
getComputedProperty
public @Nullable Node getComputedProperty()
Returns a COMPUTED_PROP node or null
-
hasComputedProperty
public boolean hasComputedProperty()
-
hasStringKey
public boolean hasStringKey()
-
getStringKey
public @Nullable Node getStringKey()
Returns a STRING_KEY node or null
-
getDefaultValue
public @Nullable Node getDefaultValue()
-
hasDefaultValue
public boolean hasDefaultValue()
-
getNode
public Node 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] = []`
-
-