ast
Class ReturnStmt

java.lang.Object
  extended by ast.ASTNode
      extended by ast.Stmt
          extended by ast.ReturnStmt

public class ReturnStmt
extends Stmt

The ReturnStmt class represents a return statement within the body of a method. It contains an expression to be returned (expr).

See Also:
ASTNode, Stmt

Field Summary
protected  Expr expr
          An expression to be returned (null for no return expression)
 
Fields inherited from class ast.ASTNode
charNum, lineNum, lineStr
 
Constructor Summary
ReturnStmt(int lineNum, Expr expr)
          ReturnStmt constructor
 
Method Summary
 java.lang.Object accept(visitor.Visitor v, java.lang.Object o)
          Visitor method
 Expr getExpr()
          Get the return expression
 
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

expr

protected Expr expr
An expression to be returned (null for no return expression)

Constructor Detail

ReturnStmt

public ReturnStmt(int lineNum,
                  Expr expr)
ReturnStmt constructor

Parameters:
lineNum - source line number corresponding to this AST node
expr - expression to be returned (null for no return expression)
Method Detail

getExpr

public Expr getExpr()
Get the return expression

Returns:
expression

accept

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

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