com.go.tea.parsetree
Class ReturnStatement

java.lang.Object
  |
  +--com.go.tea.parsetree.Node
        |
        +--com.go.tea.parsetree.Statement
              |
              +--com.go.tea.parsetree.ReturnStatement
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ReturnStatement
extends Statement

A ReturnStatement allows the values of Expressions to be returned from an execution scope. If the expression is null, then void is returned.

Version:
12 , 01/05/31
Author:
Brian S O'Neill
See Also:
Serialized Form

Constructor Summary
ReturnStatement(Expression expr)
          Construct a ReturnStatement from just an expression and its SourceInfo.
ReturnStatement(SourceInfo info)
          Construct a ReturnStatement that returns void.
ReturnStatement(SourceInfo info, Expression expr)
           
 
Method Summary
 java.lang.Object accept(NodeVisitor visitor)
          Every subclass of Node must override this method with the following: return visitor.visit(this).
 java.lang.Object clone()
          Returns a clone of this Node and all its children.
 Expression getExpression()
          Returns the expression to return or null if void is returned.
 boolean isBreak()
          Returns true if Statement 'breaks' during its execution.
 boolean isReturn()
          Returns true if Statement definitely returns from its method either from a return statement or a throw statement.
 void setExpression(Expression expr)
           
 
Methods inherited from class com.go.tea.parsetree.Node
getSourceInfo, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReturnStatement

public ReturnStatement(SourceInfo info,
                       Expression expr)

ReturnStatement

public ReturnStatement(Expression expr)
Construct a ReturnStatement from just an expression and its SourceInfo.

ReturnStatement

public ReturnStatement(SourceInfo info)
Construct a ReturnStatement that returns void.
Method Detail

accept

public java.lang.Object accept(NodeVisitor visitor)
Description copied from class: Node
Every subclass of Node must override this method with the following: return visitor.visit(this).
Overrides:
accept in class Statement
Following copied from class: com.go.tea.parsetree.Node
Parameters:
visitor - A visitor of this Node
Returns:
Node The Node returned by the visitor
See Also:
NodeVisitor

clone

public java.lang.Object clone()
Description copied from class: Node
Returns a clone of this Node and all its children. Immutable child objects are not necessarily cloned
Overrides:
clone in class Node

isReturn

public boolean isReturn()
Description copied from class: Statement
Returns true if Statement definitely returns from its method either from a return statement or a throw statement.
Overrides:
isReturn in class Statement

isBreak

public boolean isBreak()
Description copied from class: Statement
Returns true if Statement 'breaks' during its execution.
Overrides:
isBreak in class Statement

getExpression

public Expression getExpression()
Returns the expression to return or null if void is returned.

setExpression

public void setExpression(Expression expr)