class JLogicalNotOp extends JUnaryExpression
argisStatementExpression, typecompilationUnit, line| Constructor and Description |
|---|
JLogicalNotOp(int line,
JExpression arg)
Construct an AST for a logical NOT expression given its line number, and
the operand.
|
| Modifier and Type | Method and Description |
|---|---|
JExpression |
analyze(Context context)
Analyzing a logical NOT operation means analyzing its operand, insuring
it's a boolean, and setting the result to boolean.
|
void |
codegen(CLEmitter output)
Generate code for the case where we actually want a boolean value (true
or false) computed onto the stack, eg for assignment to a boolean
variable.
|
void |
codegen(CLEmitter output,
String targetLabel,
boolean onTrue)
The code generation necessary for branching simply flips the condition on
which we branch.
|
writeToStdOutisStatementExpression, typeline, partialCodegenpublic JLogicalNotOp(int line,
JExpression arg)
line - line in which the logical NOT expression occurs in the source
file.arg - the operand.public JExpression analyze(Context context)
analyze in class JExpressioncontext - context in which names are resolved.public void codegen(CLEmitter output)
public void codegen(CLEmitter output, String targetLabel, boolean onTrue)
codegen in class JExpressionoutput - the code emitter (basically an abstraction for producing the
.class file).targetLabel - the label to which we should branch.onTrue - do we branch on true?