coins.ast.expr
Class ConstantExpr

java.lang.Object
  extended bycoins.ast.ASTree
      extended bycoins.ast.expr.ConstantExpr
All Implemented Interfaces:
Expr, java.io.Serializable, TypeId
Direct Known Subclasses:
FloatConstantExpr, IntConstantExpr

public abstract class ConstantExpr
extends ASTree
implements Expr, TypeId

Constant class. This class has been rewritten because the original ConstantExpr class does not hold type information when constant folding is done. Objects of ConstantExpr can not be changed as it is for String object. If you are tempted to change the value of constant object, you should construct new object instead of changing the value.

See Also:
Serialized Form

Field Summary
protected  byte[] fType
           
 
Fields inherited from interface coins.ast.TypeId
ARRAY_T, CHAR_T, CONST_T, DOUBLE_T, ELLIPSIS_T, ENUM_BEGIN, ENUM_END, FLOAT_T, FUNCTION_T, INT_T, LONG_DOUBLE_T, LONG_LONG_T, LONG_T, NO_DIMENSION_T, OFFSET_T, POINTER_T, RESTRICT_T, RETURN_T, S_AUTO, S_EXTERN, S_INLINE, S_NONE, S_REGISTER, S_STATIC, SHORT_T, SIGNED_T, SIZE_T, STRUCT_BEGIN, STRUCT_END, UNION_BEGIN, UNION_END, UNSIGNED_T, VOID_T, VOLATILE_T
 
Constructor Summary
ConstantExpr()
           
 
Method Summary
 void accept(Visitor v)
          Is a method for the visitor pattern.
abstract  double doubleValue()
           
 ASTree getLeft()
           
 ASTree getRight()
           
abstract  char getSignChar()
           
 byte[] getType()
          Returns the type of the resulting value of evaluating the expression.
abstract  char getTypeChar()
           
abstract  long longValue()
           
 void setLeft(ASTree left)
           
 void setRight(ASTree right)
           
 
Methods inherited from class coins.ast.ASTree
getTag, putSeparator, rightToString, toString, toString1
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fType

protected byte[] fType
Constructor Detail

ConstantExpr

public ConstantExpr()
Method Detail

longValue

public abstract long longValue()

doubleValue

public abstract double doubleValue()

getSignChar

public abstract char getSignChar()

getTypeChar

public abstract char getTypeChar()

getLeft

public ASTree getLeft()
Specified by:
getLeft in class ASTree

getRight

public ASTree getRight()
Specified by:
getRight in class ASTree

setLeft

public void setLeft(ASTree left)
Specified by:
setLeft in class ASTree

setRight

public void setRight(ASTree right)
Specified by:
setRight in class ASTree

accept

public void accept(Visitor v)
Description copied from class: ASTree
Is a method for the visitor pattern. It calls atXXX() on the given visitor, where XXX is the class name of the node object.

Specified by:
accept in class ASTree

getType

public byte[] getType()
Description copied from interface: Expr
Returns the type of the resulting value of evaluating the expression. See ast.TypeId

Specified by:
getType in interface Expr
Returns:
the encoded type.