Class DestructuredTarget

java.lang.Object
com.google.javascript.jscomp.DestructuredTarget

public final class DestructuredTarget extends 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 call inferType if desired.

  • Method Details Link icon

    • getComputedProperty Link icon

      public @Nullable Node getComputedProperty()
      Returns a COMPUTED_PROP node or null
    • hasComputedProperty Link icon

      public boolean hasComputedProperty()
    • hasStringKey Link icon

      public boolean hasStringKey()
    • getStringKey Link icon

      public @Nullable Node getStringKey()
      Returns a STRING_KEY node or null
    • getDefaultValue Link icon

      public @Nullable Node getDefaultValue()
    • hasDefaultValue Link icon

      public boolean hasDefaultValue()
    • getNode Link icon

      public Node getNode()
    • createAllNonEmptyTargetsInPattern Link icon

      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 nodes

      EMPTY nodes occur in array patterns with elisions, e.g. `[, , a] = []`

    • createAllNonEmptyTargetsInPattern Link icon

      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 nodes

      EMPTY nodes occur in array patterns with elisions, e.g. `[, , a] = []`