ast
Class CastExpr

java.lang.Object
  extended by ast.ASTNode
      extended by ast.Expr
          extended by ast.CastExpr

public class CastExpr
extends Expr

The CastExpr class represents a cast expression. It contains a target type name (type), an expression to cast (expr), and a flag indicating whether the cast is an upcast (upcast).

See Also:
ASTNode, Expr

Field Summary
protected  Expr expr
          The expression to cast
protected  java.lang.String type
          The target type
protected  boolean upcast
          Boolean indicating whether the cast is an upcast
 
Fields inherited from class ast.ASTNode
charNum, lineNum, lineStr
 
Constructor Summary
CastExpr(int lineNum, java.lang.String type, Expr expr)
          CastExpr constructor
 
Method Summary
 java.lang.Object accept(visitor.Visitor v, java.lang.Object o)
          Visitor method
 Expr getExpr()
          Get the expression to cast
 java.lang.String getType()
          Get the target type
 boolean getUpCast()
          Is this an upcast?
 void setUpCast(boolean upcast)
          Set whether the cast is an upcast
 
Methods inherited from class ast.Expr
getExprType, setExprType
 
Methods inherited from class ast.ASTNode
getLineNum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected java.lang.String type
The target type


expr

protected Expr expr
The expression to cast


upcast

protected boolean upcast
Boolean indicating whether the cast is an upcast

Constructor Detail

CastExpr

public CastExpr(int lineNum,
                java.lang.String type,
                Expr expr)
CastExpr constructor

Parameters:
lineNum - source line number corresponding to this AST node
type - the target type
expr - expression to cast
Method Detail

getType

public java.lang.String getType()
Get the target type

Returns:
type

getExpr

public Expr getExpr()
Get the expression to cast

Returns:
expression

getUpCast

public boolean getUpCast()
Is this an upcast?

Returns:
boolean indicating whether this cast is an upcast

setUpCast

public void setUpCast(boolean upcast)
Set whether the cast is an upcast

Parameters:
upcast - boolean indicating whether cast is an upcast

accept

public java.lang.Object accept(visitor.Visitor v,
                               java.lang.Object o)
Visitor method

Specified by:
accept in class Expr
Parameters:
v - visitor object
o - object to pass down
Returns:
result of visiting this node
See Also:
Visitor