class JLogicalAndOp extends JBooleanBinaryExpression
lhs, operator, rhs
isStatementExpression, type
compilationUnit, line
Constructor and Description |
---|
JLogicalAndOp(int line,
JExpression lhs,
JExpression rhs)
Construct an AST node for a logical AND expression given its line number,
and lhs and rhs operands.
|
Modifier and Type | Method and Description |
---|---|
JExpression |
analyze(Context context)
Analyzing a logical AND expression involves analyzing its operands and
insuring they are boolean; the result type is of course boolean.
|
void |
codegen(CLEmitter output,
String targetLabel,
boolean onTrue)
The semantics of j-- require that we implement short-circuiting branching
in implementing the logical AND.
|
codegen
writeToStdOut
isStatementExpression, type
line, partialCodegen
public JLogicalAndOp(int line, JExpression lhs, JExpression rhs)
line
- line in which the logical AND expression occurs in the source
file.lhs
- lhs operand.rhs
- rhs operand.public JExpression analyze(Context context)
analyze
in class JExpression
context
- context in which names are resolved.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
- target for generated branch instruction.onTrue
- should we branch on true?