/** * 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. * * @param output the code emitter (basically an abstraction for producing the .class file). */ public void codegen(CLEmitter output) { String elseLabel = output.createLabel(); String endIfLabel = output.createLabel(); this.codegen(output, elseLabel, false); output.addNoArgInstruction(ICONST_1); // true output.addBranchInstruction(GOTO, endIfLabel); output.addLabel(elseLabel); output.addNoArgInstruction(ICONST_0); // false output.addLabel(endIfLabel); }