class JLogicalNotOp extends JUnaryExpression
arg
isStatementExpression, type
compilationUnit, 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.
|
writeToStdOut
isStatementExpression, type
line, partialCodegen
public 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 JExpression
context
- context in which names are resolved.public void codegen(CLEmitter output)
public void codegen(CLEmitter output, String targetLabel, boolean onTrue)
codegen
in class JExpression
output
- 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?