edu.uci.eecs.doc.cascade.controlflow
Class ReturnStatement

java.lang.Object
  extended by edu.uci.eecs.doc.cascade.controlflow.Node
      extended by edu.uci.eecs.doc.cascade.controlflow.Statement
          extended by edu.uci.eecs.doc.cascade.controlflow.ReturnStatement
All Implemented Interfaces:
Iterable<Node>

public class ReturnStatement
extends Statement

Represents return statements in control flow graphs and trees. This also includes implicit return instructions added by the compiler in methods that return void.

Author:
Trevor Harmon

Field Summary
 
Fields inherited from class edu.uci.eecs.doc.cascade.controlflow.Node
block, nextNode, parent, scope, tree
 
Constructor Summary
ReturnStatement(Tree tree, int scope, Node parent, ReturnBlock returnBlock, List<InstructionHandle> instructions)
          Creates a new ReturnStatement object.
 
Method Summary
 List<MethodInvocation> getMethodInvocations()
          Returns the methods that this statement invokes.
 String toString()
          Converts the if-then-else construct to a string.
 
Methods inherited from class edu.uci.eecs.doc.cascade.controlflow.Statement
getExpression
 
Methods inherited from class edu.uci.eecs.doc.cascade.controlflow.Node
getBlock, getEnclosingLoop, getFirstInstruction, getInstructions, getLastInstruction, getMethodInvocations, getNext, getOutermostLoop, getParent, getScope, getSourceCodeLineNumber, getStartAddress, getTree, iterator, lastNode, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReturnStatement

public ReturnStatement(Tree tree,
                       int scope,
                       Node parent,
                       ReturnBlock returnBlock,
                       List<InstructionHandle> instructions)
Creates a new ReturnStatement object.

Parameters:
tree - the control flow tree to which this node belongs
scope - the lexical scope of the node (0 = top-level scope)
parent - the node's parent (null if the node has no parent)
returnBlock - a JODE object representing the return statement
instructions - the list of instructions in the return statement's method (the whole method, not just the statement)
Method Detail

getMethodInvocations

public List<MethodInvocation> getMethodInvocations()
Returns the methods that this statement invokes.

Overrides:
getMethodInvocations in class Statement
Returns:
a set of Java method handles, or an empty set if this statement does not invoke any methods

toString

public String toString()
Converts the if-then-else construct to a string.

Overrides:
toString in class Statement
Returns:
a source-code-like string representing the return statement