Fix ternary

This commit is contained in:
2026-09-18 12:21:49 -05:00
parent 175afbafeb
commit 354fb4293d
+2 -4
View File
@@ -1085,16 +1085,14 @@ void CodeGen::GenNode(std::vector<ByteCodeInstruction *> &instructions,
GenNode(instructions, adv.nodes[0], scope, contscope, brkscope, GenNode(instructions, adv.nodes[0], scope, contscope, brkscope,
contI, brkI); contI, brkI);
instructions.push_back(new JumpStyleInstruction(JMPC, ifIdTrue)); instructions.push_back(new JumpStyleInstruction(JMPC, ifIdTrue));
if (!std::holds_alternative<std::nullptr_t>(adv.nodes[2])) {
GenNode(instructions, adv.nodes[2], scope, contscope, brkscope, GenNode(instructions, adv.nodes[2], scope, contscope, brkscope,
contI, brkI); contI, brkI);
}
instructions.push_back(new JumpStyleInstruction(JMP, ifIdEnd)); instructions.push_back(new JumpStyleInstruction(JMP, ifIdEnd));
instructions.push_back(new LabelInstruction(ifIdTrue)); instructions.push_back(new LabelInstruction(ifIdTrue));
if (!std::holds_alternative<std::nullptr_t>(adv.nodes[1])) {
GenNode(instructions, adv.nodes[1], scope, contscope, brkscope, GenNode(instructions, adv.nodes[1], scope, contscope, brkscope,
contI, brkI); contI, brkI);
}
instructions.push_back(new LabelInstruction(ifIdEnd)); instructions.push_back(new LabelInstruction(ifIdEnd));
} else if (adv.nodeName == CompoundAssignExpression && } else if (adv.nodeName == CompoundAssignExpression &&