class JIfStatement extends JStatement
compilationUnit, line
Constructor and Description |
---|
JIfStatement(int line,
JExpression condition,
JStatement thenPart,
JStatement elsePart)
Construct an AST node for an if-statement given its line number, the test
expression, the consequent, and the alternate.
|
Modifier and Type | Method and Description |
---|---|
JStatement |
analyze(Context context)
Analyzing the if-statement means analyzing its components and checking
that the test is boolean.
|
void |
codegen(CLEmitter output)
Code generation for an if-statement.
|
void |
writeToStdOut(PrettyPrinter p)
Write the information pertaining to this AST to STDOUT.
|
line, partialCodegen
public JIfStatement(int line, JExpression condition, JStatement thenPart, JStatement elsePart)
line
- line in which the if-statement occurs in the source file.condition
- test expression.thenPart
- then clause.elsePart
- else clause.public JStatement analyze(Context context)
public void codegen(CLEmitter output)
public void writeToStdOut(PrettyPrinter p)
JAST
writeToStdOut
in class JAST
p
- for pretty printing with indentation.