// Translate left hand side - must be true
_left.translateDesynthesized(classGen, methodGen);
// Need this for chaining any OR-expression children
InstructionHandle middle = il.append(NOP);
// Translate left right side - must be true
_right.translateDesynthesized(classGen, methodGen);
// Need this for chaining any OR-expression children
InstructionHandle after = il.append(NOP);
// Append child expression false-lists to our false-list
_falseList.append(_right._falseList.append(_left._falseList));
// Special case for OR-expression as a left child of AND.
// The true-list of OR must point to second clause of AND.
if ((_left instanceof LogicalExpr) &&
(((LogicalExpr)_left).getOp() == OR)) {
_left.backPatchTrueList(middle);
}
else if (_left instanceof NotCall) {
_left.backPatchTrueList(middle);
}
else {
_trueList.append(_left._trueList);
}
// Special case for OR-expression as a right child of AND
// The true-list of OR must point to true-list of AND.
if ((_right instanceof LogicalExpr) &&
(((LogicalExpr)_right).getOp() == OR)) {
_right.backPatchTrueList(after);
}
else if (_right instanceof NotCall) {
_right.backPatchTrueList(after);
}
else {
_trueList.append(_right._trueList);
}
}
// Compile OR-expression
else {
// Translate left-hand side expression and produce true/false list
_left.translateDesynthesized(classGen, methodGen);
// This GOTO is used to skip over the code for the last test
// in the case where the the first test succeeds
InstructionHandle ih = il.append(new GOTO(null));
// Translate right-hand side expression and produce true/false list
_right.translateDesynthesized(classGen, methodGen);
_left._trueList.backPatch(ih);
_left._falseList.backPatch(ih.getNext());
_falseList.append(_right._falseList);
_trueList.add(ih).append(_right._trueList);
}
}