polyglot.types
Class VarInstance_c

java.lang.Object
  extended by polyglot.types.TypeObject_c
      extended by polyglot.types.VarInstance_c
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Declaration, TypeObject, VarInstance, Copy
Direct Known Subclasses:
FieldInstance_c, LocalInstance_c

public abstract class VarInstance_c
extends TypeObject_c
implements VarInstance

A VarInstance contains type information for a variable. It may be either a local or a field.

See Also:
Serialized Form

Field Summary
protected  java.lang.Object constantValue
           
protected  boolean constantValueSet
           
protected  VarInstance decl
           
protected  Flags flags
           
protected  boolean isConstant
           
protected  java.lang.String name
           
protected  Type type
           
 
Fields inherited from class polyglot.types.TypeObject_c
position, ts
 
Constructor Summary
protected VarInstance_c()
          Used for deserializing types.
  VarInstance_c(TypeSystem ts, Position pos, Flags flags, Type type, java.lang.String name)
           
 
Method Summary
 java.lang.Object constantValue()
          The variable's constant value, or null.
 boolean constantValueSet()
          Whether the variable's constant value has been set yet.
 Declaration declaration()
          Get the original declaration.
 boolean equalsImpl(TypeObject o)
          Default implementation is pointer equality.
 Flags flags()
          The flags of the variable.
 int hashCode()
           
 boolean isCanonical()
          Return true if the type object contains no unknown/ambiguous types.
 boolean isConstant()
          Whether the variable has a constant value.
 java.lang.String name()
          The name of the variable.
 void setConstantValue(java.lang.Object constantValue)
          Destructive update of constant value.
 void setDeclaration(Declaration decl)
          Set the original declaration.
 void setFlags(Flags flags)
          Destructively set the flags of the variable.
 void setName(java.lang.String name)
           
 void setNotConstant()
          Mark the variable as not a compile time constant.
 void setType(Type type)
          Destructively set the type of the variable.
 Type type()
          The type of the variable.
 
Methods inherited from class polyglot.types.TypeObject_c
copy, equals, position, typeSystem
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flags

protected Flags flags

type

protected Type type

name

protected java.lang.String name

constantValue

protected java.lang.Object constantValue

isConstant

protected boolean isConstant

constantValueSet

protected boolean constantValueSet

decl

protected VarInstance decl
Constructor Detail

VarInstance_c

protected VarInstance_c()
Used for deserializing types.


VarInstance_c

public VarInstance_c(TypeSystem ts,
                     Position pos,
                     Flags flags,
                     Type type,
                     java.lang.String name)
Method Detail

declaration

public Declaration declaration()
Description copied from interface: Declaration
Get the original declaration.

Specified by:
declaration in interface Declaration

setDeclaration

public void setDeclaration(Declaration decl)
Description copied from interface: Declaration
Set the original declaration.

Specified by:
setDeclaration in interface Declaration

constantValueSet

public boolean constantValueSet()
Description copied from interface: VarInstance
Whether the variable's constant value has been set yet.

Specified by:
constantValueSet in interface VarInstance

isConstant

public boolean isConstant()
Description copied from interface: VarInstance
Whether the variable has a constant value.

Specified by:
isConstant in interface VarInstance

constantValue

public java.lang.Object constantValue()
Description copied from interface: VarInstance
The variable's constant value, or null.

Specified by:
constantValue in interface VarInstance

flags

public Flags flags()
Description copied from interface: VarInstance
The flags of the variable.

Specified by:
flags in interface VarInstance

type

public Type type()
Description copied from interface: VarInstance
The type of the variable.

Specified by:
type in interface VarInstance

name

public java.lang.String name()
Description copied from interface: VarInstance
The name of the variable.

Specified by:
name in interface VarInstance

hashCode

public int hashCode()
Overrides:
hashCode in class TypeObject_c

equalsImpl

public boolean equalsImpl(TypeObject o)
Description copied from class: TypeObject_c
Default implementation is pointer equality.

Specified by:
equalsImpl in interface TypeObject
Overrides:
equalsImpl in class TypeObject_c
See Also:
TypeObject_c.equalsImpl(TypeObject), Object.hashCode()

isCanonical

public boolean isCanonical()
Description copied from interface: TypeObject
Return true if the type object contains no unknown/ambiguous types.

Specified by:
isCanonical in interface TypeObject

setType

public void setType(Type type)
Description copied from interface: VarInstance
Destructively set the type of the variable. This method should be deprecated.

Specified by:
setType in interface VarInstance

setFlags

public void setFlags(Flags flags)
Description copied from interface: VarInstance
Destructively set the flags of the variable.

Specified by:
setFlags in interface VarInstance

setConstantValue

public void setConstantValue(java.lang.Object constantValue)
Destructive update of constant value.

Specified by:
setConstantValue in interface VarInstance
Parameters:
constantValue - the constant value. Should be an instance of String, Boolean, Byte, Short, Character, Integer, Long, Float, Double, or null.

setNotConstant

public void setNotConstant()
Description copied from interface: VarInstance
Mark the variable as not a compile time constant.

Specified by:
setNotConstant in interface VarInstance

setName

public void setName(java.lang.String name)
Specified by:
setName in interface VarInstance
Parameters:
name - The name to set.