edu.uci.eecs.doc.cascade.controlflow
Class Statement
java.lang.Object
edu.uci.eecs.doc.cascade.controlflow.Node
edu.uci.eecs.doc.cascade.controlflow.Statement
- All Implemented Interfaces:
- Iterable<Node>
- Direct Known Subclasses:
- ReturnStatement
public class Statement
- extends Node
Represents simple statements (e.g., i = x + y
) in control flow graphs and trees.
- Author:
- Trevor Harmon
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 |
Statement
public Statement(Tree tree,
int scope,
Node parent,
InstructionContainer instructionContainer,
List<InstructionHandle> instructions)
- Creates a new Statement object.
- Parameters:
tree
- the control flow tree to which this node belongsscope
- the lexical scope of the node (0 = top-level scope)parent
- the node's parent (null if the node has no parent)instructionContainer
- a JODE object representing the statementinstructions
- the list of instructions in the statement's method (the
whole method, not just the statement)
getMethodInvocations
public List<MethodInvocation> getMethodInvocations()
- Returns the methods that this statement invokes in the order in which they are
invoked. If the same method is invoked more than once, it will appear in the
list more than once.
- Overrides:
getMethodInvocations
in class Node
- Returns:
- a list of Java method handles, or an empty list if this statement does
not invoke any methods
toString
public String toString()
- Converts the statement to a string.
- Overrides:
toString
in class Object
- Returns:
- a source-code-like string representing the statement
getExpression
protected Expression getExpression()
- Returns the statement's expression.
- Returns:
- a JODE object representing a Java expression, or null if the statement
has no expression (e.g., return void statements)