public final class RawNominalType extends Namespace
Modifier and Type | Class and Description |
---|---|
private static class |
RawNominalType.Kind |
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.ImmutableSet<java.lang.String> |
allProps |
private PersistentMap<java.lang.String,Property> |
classProps |
private FunctionType |
ctorFn |
private Node |
defSite |
private com.google.common.collect.ImmutableSet<NominalType> |
interfaces |
private boolean |
isFinalized |
private RawNominalType.Kind |
kind |
private ObjectKind |
objectKind |
private PersistentMap<java.lang.String,Property> |
protoProps |
private PersistentMap<java.lang.String,Property> |
randomProps |
private NominalType |
superClass |
private com.google.common.collect.ImmutableList<java.lang.String> |
typeParameters |
private JSType |
wrappedAsJSType |
private NominalType |
wrappedAsNominal |
private JSType |
wrappedAsNullableJSType |
name, namespaceType, otherProps
Modifier | Constructor and Description |
---|---|
private |
RawNominalType(Node defSite,
java.lang.String name,
com.google.common.collect.ImmutableList<java.lang.String> typeParameters,
RawNominalType.Kind kind,
ObjectKind objectKind) |
Modifier and Type | Method and Description |
---|---|
void |
addClassProperty(java.lang.String pname,
Node defSite,
JSType type,
boolean isConstant)
Add a new non-optional declared property to instances of this class
|
void |
addCtorProperty(java.lang.String pname,
Node defSite,
JSType type,
boolean isConstant)
Add a new non-optional declared property to this class's constructor
|
boolean |
addInterfaces(com.google.common.collect.ImmutableSet<NominalType> interfaces) |
void |
addPropertyWhichMayNotBeOnAllInstances(java.lang.String pname,
JSType type) |
void |
addProtoProperty(java.lang.String pname,
Node defSite,
JSType type,
boolean isConstant)
Add a new declared prototype property to this class
|
boolean |
addSuperClass(NominalType superClass) |
void |
addUndeclaredClassProperty(java.lang.String pname,
JSType type,
Node defSite)
Add a new undeclared property to instances of this class
|
void |
addUndeclaredCtorProperty(java.lang.String pname,
Node defSite)
Add a new undeclared property to this class's constructor
|
void |
addUndeclaredProtoProperty(java.lang.String pname,
Node defSite)
Add a new undeclared prototype property to this class
|
(package private) java.lang.StringBuilder |
appendTo(java.lang.StringBuilder builder) |
protected JSType |
computeJSType(JSTypes commonTypes) |
void |
finalize() |
java.util.Set<java.lang.String> |
getAllOwnProps() |
(package private) com.google.common.collect.ImmutableSet<java.lang.String> |
getAllPropsOfClass() |
(package private) com.google.common.collect.ImmutableSet<java.lang.String> |
getAllPropsOfInterface() |
NominalType |
getAsNominalType() |
FunctionType |
getConstructorFunction() |
JSType |
getCtorPropDeclaredType(java.lang.String pname) |
Node |
getDefSite() |
JSType |
getInstanceAsJSType() |
JSType |
getInstancePropDeclaredType(java.lang.String pname) |
JSType |
getInstanceWithNullability(boolean includeNull) |
com.google.common.collect.ImmutableSet<NominalType> |
getInterfaces() |
(package private) ObjectKind |
getObjectKind() |
private Property |
getOwnProp(java.lang.String pname) |
(package private) Property |
getProp(java.lang.String pname) |
private Property |
getPropFromClass(java.lang.String pname) |
private Property |
getPropFromInterface(java.lang.String pname) |
NominalType |
getSuperClass() |
(package private) com.google.common.collect.ImmutableList<java.lang.String> |
getTypeParameters() |
(package private) boolean |
hasAncestorClass(RawNominalType ancestor) |
(package private) boolean |
hasAncestorInterface(RawNominalType ancestor) |
boolean |
hasCtorProp(java.lang.String pname) |
private boolean |
inheritsFromIObject() |
private static boolean |
isBuiltinHelper(java.lang.String nameToCheck,
java.lang.String builtinName,
Node defSite) |
(package private) boolean |
isBuiltinWithName(java.lang.String s) |
boolean |
isClass() |
boolean |
isDict() |
boolean |
isFinalized() |
(package private) boolean |
isGeneric() |
boolean |
isInterface() |
boolean |
isStruct() |
(package private) boolean |
isStructuralInterface() |
static RawNominalType |
makeDictClass(Node defSite,
java.lang.String name,
com.google.common.collect.ImmutableList<java.lang.String> typeParameters) |
static RawNominalType |
makeNominalInterface(Node defSite,
java.lang.String name,
com.google.common.collect.ImmutableList<java.lang.String> typeParameters) |
static RawNominalType |
makeStructClass(Node defSite,
java.lang.String name,
com.google.common.collect.ImmutableList<java.lang.String> typeParameters) |
static RawNominalType |
makeStructuralInterface(Node defSite,
java.lang.String name,
com.google.common.collect.ImmutableList<java.lang.String> typeParameters) |
static RawNominalType |
makeUnrestrictedClass(Node defSite,
java.lang.String name,
com.google.common.collect.ImmutableList<java.lang.String> typeParameters) |
boolean |
mayHaveOwnProp(java.lang.String pname) |
boolean |
mayHaveProp(java.lang.String pname) |
void |
setCtorFunction(FunctionType ctorFn) |
java.lang.String |
toString() |
addNamespace, addProperty, addTypedef, addUndeclaredProperty, copyWindowProperties, getAllPropsOfNamespace, getDeclaration, getName, getNsProp, getPropDeclaredType, getSubnamespace, hasProp, hasSubnamespace, isDefined, toJSType
private final Node defSite
private boolean isFinalized
private PersistentMap<java.lang.String,Property> classProps
private PersistentMap<java.lang.String,Property> protoProps
private PersistentMap<java.lang.String,Property> randomProps
private NominalType superClass
private com.google.common.collect.ImmutableSet<NominalType> interfaces
private final RawNominalType.Kind kind
private com.google.common.collect.ImmutableSet<java.lang.String> allProps
private final NominalType wrappedAsNominal
private final JSType wrappedAsJSType
private final JSType wrappedAsNullableJSType
private final com.google.common.collect.ImmutableList<java.lang.String> typeParameters
private ObjectKind objectKind
private FunctionType ctorFn
private RawNominalType(Node defSite, java.lang.String name, com.google.common.collect.ImmutableList<java.lang.String> typeParameters, RawNominalType.Kind kind, ObjectKind objectKind)
public static RawNominalType makeUnrestrictedClass(Node defSite, java.lang.String name, com.google.common.collect.ImmutableList<java.lang.String> typeParameters)
public static RawNominalType makeStructClass(Node defSite, java.lang.String name, com.google.common.collect.ImmutableList<java.lang.String> typeParameters)
public static RawNominalType makeDictClass(Node defSite, java.lang.String name, com.google.common.collect.ImmutableList<java.lang.String> typeParameters)
public static RawNominalType makeNominalInterface(Node defSite, java.lang.String name, com.google.common.collect.ImmutableList<java.lang.String> typeParameters)
public static RawNominalType makeStructuralInterface(Node defSite, java.lang.String name, com.google.common.collect.ImmutableList<java.lang.String> typeParameters)
public Node getDefSite()
private static boolean isBuiltinHelper(java.lang.String nameToCheck, java.lang.String builtinName, Node defSite)
boolean isBuiltinWithName(java.lang.String s)
public boolean isClass()
public boolean isInterface()
boolean isStructuralInterface()
boolean isGeneric()
public boolean isStruct()
public boolean isDict()
public boolean isFinalized()
com.google.common.collect.ImmutableList<java.lang.String> getTypeParameters()
ObjectKind getObjectKind()
public FunctionType getConstructorFunction()
public void setCtorFunction(FunctionType ctorFn)
boolean hasAncestorClass(RawNominalType ancestor)
public boolean addSuperClass(NominalType superClass)
boolean hasAncestorInterface(RawNominalType ancestor)
private boolean inheritsFromIObject()
public boolean addInterfaces(com.google.common.collect.ImmutableSet<NominalType> interfaces)
public NominalType getSuperClass()
public com.google.common.collect.ImmutableSet<NominalType> getInterfaces()
private Property getOwnProp(java.lang.String pname)
private Property getPropFromClass(java.lang.String pname)
private Property getPropFromInterface(java.lang.String pname)
Property getProp(java.lang.String pname)
public boolean mayHaveOwnProp(java.lang.String pname)
public boolean mayHaveProp(java.lang.String pname)
public JSType getInstancePropDeclaredType(java.lang.String pname)
public java.util.Set<java.lang.String> getAllOwnProps()
com.google.common.collect.ImmutableSet<java.lang.String> getAllPropsOfInterface()
com.google.common.collect.ImmutableSet<java.lang.String> getAllPropsOfClass()
public void addPropertyWhichMayNotBeOnAllInstances(java.lang.String pname, JSType type)
public void addClassProperty(java.lang.String pname, Node defSite, JSType type, boolean isConstant)
public void addUndeclaredClassProperty(java.lang.String pname, JSType type, Node defSite)
public void addProtoProperty(java.lang.String pname, Node defSite, JSType type, boolean isConstant)
public void addUndeclaredProtoProperty(java.lang.String pname, Node defSite)
public boolean hasCtorProp(java.lang.String pname)
public void addCtorProperty(java.lang.String pname, Node defSite, JSType type, boolean isConstant)
public void addUndeclaredCtorProperty(java.lang.String pname, Node defSite)
public JSType getCtorPropDeclaredType(java.lang.String pname)
public void finalize()
finalize
in class java.lang.Object
java.lang.StringBuilder appendTo(java.lang.StringBuilder builder)
protected JSType computeJSType(JSTypes commonTypes)
computeJSType
in class Namespace
public NominalType getAsNominalType()
public JSType getInstanceAsJSType()
public JSType getInstanceWithNullability(boolean includeNull)