Class Color
- java.lang.Object
-
- com.google.javascript.jscomp.colors.Color
-
- All Implemented Interfaces:
java.io.Serializable
@Immutable public abstract class Color extends java.lang.Object implements java.io.Serializable
A simplified version of a Closure or TS type for use by optimizations- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Color()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Color
createSingleton(SingletonColorFields fields)
static Color
createUnion(com.google.common.collect.ImmutableSet<Color> alternates)
com.google.common.collect.ImmutableSet<DebugInfo>
getDebugInfo()
com.google.common.collect.ImmutableList<Color>
getDisambiguationSupertypes()
com.google.common.collect.ImmutableSet<java.lang.String>
getId()
com.google.common.collect.ImmutableSet<Color>
getInstanceColor()
com.google.common.collect.ImmutableSet<NativeColorId>
getNativeColorIds()
com.google.common.collect.ImmutableSet<java.lang.String>
getOwnProperties()
com.google.common.collect.ImmutableSet<Color>
getPrototype()
boolean
is(NativeColorId color)
Whether this is exactly the given native color (and not a union containing that colorboolean
isClosureAssert()
Whether this type is some Closure assertion function removable by Closure-specific optimizations.boolean
isConstructor()
Whether this is a constructor (a type that TypeScript or Closure allows calling with 'new'boolean
isInvalidating()
boolean
isPrimitive()
Whether this corresponds to a single JavaScript primitive like number or symbol or to a union of such primitivesboolean
isUnion()
boolean
mayHaveProperty(java.lang.String propertyName)
Returns true if the color or any of its ancestors has the given propertyboolean
propertiesKeepOriginalName()
Color
subtractNullOrVoid()
abstract com.google.common.collect.ImmutableCollection<Color>
union()
-
-
-
Method Detail
-
union
public abstract com.google.common.collect.ImmutableCollection<Color> union()
-
isPrimitive
public final boolean isPrimitive()
Whether this corresponds to a single JavaScript primitive like number or symbol or to a union of such primitivesNote that the boxed versions of primitives (String, Number, etc.) are /not/ considered "primitive" by this method.
-
isClosureAssert
public final boolean isClosureAssert()
Whether this type is some Closure assertion function removable by Closure-specific optimizations.
-
isUnion
public final boolean isUnion()
-
isInvalidating
public final boolean isInvalidating()
-
propertiesKeepOriginalName
public final boolean propertiesKeepOriginalName()
-
is
public final boolean is(NativeColorId color)
Whether this is exactly the given native color (and not a union containing that color
-
isConstructor
public final boolean isConstructor()
Whether this is a constructor (a type that TypeScript or Closure allows calling with 'new'For unions, returns true if and only if all alternates in the union are constructors
-
getOwnProperties
public com.google.common.collect.ImmutableSet<java.lang.String> getOwnProperties()
-
mayHaveProperty
public boolean mayHaveProperty(java.lang.String propertyName)
Returns true if the color or any of its ancestors has the given propertyIf this is a union, returns true if /any/ union alternate has the property.
TODO(b/177695515): delete this method
-
getId
public final com.google.common.collect.ImmutableSet<java.lang.String> getId()
-
getDebugInfo
public final com.google.common.collect.ImmutableSet<DebugInfo> getDebugInfo()
-
getPrototype
public final com.google.common.collect.ImmutableSet<Color> getPrototype()
-
getInstanceColor
public final com.google.common.collect.ImmutableSet<Color> getInstanceColor()
-
getDisambiguationSupertypes
public final com.google.common.collect.ImmutableList<Color> getDisambiguationSupertypes()
-
getNativeColorIds
public final com.google.common.collect.ImmutableSet<NativeColorId> getNativeColorIds()
-
createSingleton
public static Color createSingleton(SingletonColorFields fields)
-
createUnion
public static Color createUnion(com.google.common.collect.ImmutableSet<Color> alternates)
-
subtractNullOrVoid
public final Color subtractNullOrVoid()
-
-