Class 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 call inferType if desired.

    • Method Detail

      • getComputedProperty

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

        public boolean hasComputedProperty()
      • hasStringKey

        public boolean hasStringKey()
      • getStringKey

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

        @Nullable
        public 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 nodes

        EMPTY 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 nodes

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