comp
Class IfNode
java.lang.Object
|
+--comp.Node
|
+--comp.IfNode
- class IfNode
- extends Node
A conditional. Consists of a test expression and two blocks: one
for the then clause, another for the else clause.
Method Summary |
void |
addDefs(Scope s)
Add any variable definitions made by this node to the given scope. |
void |
asHTML(java.io.PrintStream out)
Process the test, followed by the thenClause, followed by the
elseClause |
java.lang.String |
codeGen(Scope scope,
RegBank bank)
Generate code for the test. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
test
ExprNode test
thenClause
BlockNode thenClause
elseClause
BlockNode elseClause
IfNode
public IfNode(ExprNode test,
BlockNode thenClause,
BlockNode elseClause)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
codeGen
public java.lang.String codeGen(Scope scope,
RegBank bank)
- Generate code for the test. If it is false, we branch to the
else clause, otherwise fall through to the then clause. The
then clause is anchored with a jump to the bottom of the else
clause.
- Specified by:
codeGen
in class Node
addDefs
public void addDefs(Scope s)
- Description copied from class:
Node
- Add any variable definitions made by this node to the given scope.
- Overrides:
addDefs
in class Node
asHTML
public void asHTML(java.io.PrintStream out)
- Process the test, followed by the thenClause, followed by the
elseClause
- Specified by:
asHTML
in class Node