ast
Class VarExpr

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

public class VarExpr
extends Expr

The VarExpr class represents variable expressions. It contains the name of the variable. Note: these may actually be 'this', 'super', or 'null'. Also, these may or may not include a reference object name (if the variable is a field). Because fields are 'protected' in Bantam Java, the reference object name must always be either 'this' or 'super'.

See Also:
ASTNode, Expr

Field Summary
protected  java.lang.String name
          The name of the variable (possibly 'this', 'super', or 'null')
protected  Expr ref
          The optional reference object expression (must be 'this' or 'super' for non-arrays)
 
Fields inherited from class ast.ASTNode
charNum, lineNum, lineStr
 
Constructor Summary
VarExpr(int lineNum, Expr ref, java.lang.String name)
          VarExpr constructor
 
Method Summary
 java.lang.Object accept(visitor.Visitor v, java.lang.Object o)
          Visitor method
 java.lang.String getName()
          Get the name of the variable
 Expr getRef()
          Get the reference object expression Only applicable if variable is a field (otherwise this returns null)
 
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

ref

protected Expr ref
The optional reference object expression (must be 'this' or 'super' for non-arrays)


name

protected java.lang.String name
The name of the variable (possibly 'this', 'super', or 'null')

Constructor Detail

VarExpr

public VarExpr(int lineNum,
               Expr ref,
               java.lang.String name)
VarExpr constructor

Parameters:
lineNum - source line number corresponding to this AST node
ref - the optional reference object expression (must be 'this' or 'super' for non-arrays)
name - the name of the variable
Method Detail

getRef

public Expr getRef()
Get the reference object expression Only applicable if variable is a field (otherwise this returns null)

Returns:
reference object expression

getName

public java.lang.String getName()
Get the name of the variable

Returns:
name

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