coins.ast.expr
Class ConstantExpr
java.lang.Object
coins.ast.ASTree
coins.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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
fType
protected byte[] fType
ConstantExpr
public ConstantExpr()
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.