|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teatrove.tea.parsetree.Node
org.teatrove.tea.parsetree.Statement
org.teatrove.tea.parsetree.IfStatement
public class IfStatement
An IfStatement consists of a condition, a "then" part and an "else" part. Both the then and else parts are optional, but a parser should never create an IfStatement without a then part. An optimizer may detect that the then part never executes, and so eliminates it.
| Constructor Summary | |
|---|---|
IfStatement(SourceInfo info,
Expression condition,
Block thenPart)
|
|
IfStatement(SourceInfo info,
Expression condition,
Block thenPart,
Block elsePart)
|
|
| Method Summary | |
|---|---|
Object |
accept(NodeVisitor visitor)
Every subclass of Node must override this method with the following: return visitor.visit(this). |
Object |
clone()
Returns a clone of this Node and all its children. |
Expression |
getCondition()
|
Block |
getElsePart()
|
Variable[] |
getMergedVariables()
Returns the variables that were commonly assigned in both the "then" and "else" parts of the if statement, were merged together and moved into the parent scope. |
Block |
getThenPart()
|
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 |
setCondition(Expression condition)
|
void |
setElsePart(Block block)
|
void |
setMergedVariables(Variable[] vars)
|
void |
setThenPart(Block block)
|
| Methods inherited from class org.teatrove.tea.parsetree.Node |
|---|
getSourceInfo, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IfStatement(SourceInfo info,
Expression condition,
Block thenPart)
public IfStatement(SourceInfo info,
Expression condition,
Block thenPart,
Block elsePart)
| Method Detail |
|---|
public Object accept(NodeVisitor visitor)
Nodereturn visitor.visit(this).
accept in class Statementvisitor - A visitor of this Node
NodeVisitorpublic Object clone()
Node
clone in class Nodepublic boolean isReturn()
Statement
isReturn in class Statementpublic boolean isBreak()
Statement
isBreak in class Statementpublic Expression getCondition()
public Block getThenPart()
public Block getElsePart()
public void setCondition(Expression condition)
public void setThenPart(Block block)
public void setElsePart(Block block)
public Variable[] getMergedVariables()
public void setMergedVariables(Variable[] vars)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||