Package com.google.javascript.rhino
Class NominalTypeBuilder
- java.lang.Object
-
- com.google.javascript.rhino.NominalTypeBuilder
-
public class NominalTypeBuilder extends java.lang.Object
Builder interface for declaring properties on class-like (nominal) types. Nominal types consist primarily of three separate object types, which may each have their own properties declared on them separately: (1) the constructor function, (2) the instance type, and (3) the prototype object.This builder is used during the first part of type checking, while the type checker builds up the set of known types. Thus, this interface serves as a placeholder to allow operating on (i.e. both assigning properties to, and referencing the yet-to-exist type) these not-yet-available types.
-
-
Constructor Summary
Constructors Constructor Description NominalTypeBuilder(FunctionType constructor, ObjectType instance)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FunctionType
constructor()
Returns the constructor as a JSType.void
declareConstructorProperty(java.lang.String name, JSType type, Node defSite)
Declares a static property on the nominal type's constructor.void
declareInstanceProperty(java.lang.String name, JSType type, Node defSite)
Declares an instance property on the nominal type.void
declarePrototypeProperty(java.lang.String name, JSType type, Node defSite)
Declares a property on the nominal type's prototype.ObjectType
instance()
Returns the instance type as a JSType.ObjectType
prototypeOrInstance()
Returns the type of the prototype object (OTI).NominalTypeBuilder
superClass()
Returns a NominalTypeBuilder for this type's superclass.
-
-
-
Constructor Detail
-
NominalTypeBuilder
public NominalTypeBuilder(FunctionType constructor, ObjectType instance)
-
-
Method Detail
-
declarePrototypeProperty
public void declarePrototypeProperty(java.lang.String name, JSType type, Node defSite)
Declares a property on the nominal type's prototype.
-
declareInstanceProperty
public void declareInstanceProperty(java.lang.String name, JSType type, Node defSite)
Declares an instance property on the nominal type.
-
declareConstructorProperty
public void declareConstructorProperty(java.lang.String name, JSType type, Node defSite)
Declares a static property on the nominal type's constructor.
-
superClass
public NominalTypeBuilder superClass()
Returns a NominalTypeBuilder for this type's superclass.
-
constructor
public FunctionType constructor()
Returns the constructor as a JSType.
-
instance
public ObjectType instance()
Returns the instance type as a JSType.
-
prototypeOrInstance
public ObjectType prototypeOrInstance()
Returns the type of the prototype object (OTI).
-
-