From 354fb4293de39952bcf9a707953a3fa9a1197491 Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Fri, 18 Sep 2026 12:21:49 -0500 Subject: [PATCH] Fix ternary --- src/compiler/codegen.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/compiler/codegen.cpp b/src/compiler/codegen.cpp index fad8cca..b2804f8 100644 --- a/src/compiler/codegen.cpp +++ b/src/compiler/codegen.cpp @@ -1085,16 +1085,14 @@ void CodeGen::GenNode(std::vector &instructions, GenNode(instructions, adv.nodes[0], scope, contscope, brkscope, contI, brkI); instructions.push_back(new JumpStyleInstruction(JMPC, ifIdTrue)); - if (!std::holds_alternative(adv.nodes[2])) { - GenNode(instructions, adv.nodes[2], scope, contscope, brkscope, - contI, brkI); - } + GenNode(instructions, adv.nodes[2], scope, contscope, brkscope, + contI, brkI); + instructions.push_back(new JumpStyleInstruction(JMP, ifIdEnd)); instructions.push_back(new LabelInstruction(ifIdTrue)); - if (!std::holds_alternative(adv.nodes[1])) { - GenNode(instructions, adv.nodes[1], scope, contscope, brkscope, - contI, brkI); - } + GenNode(instructions, adv.nodes[1], scope, contscope, brkscope, + contI, brkI); + instructions.push_back(new LabelInstruction(ifIdEnd)); } else if (adv.nodeName == CompoundAssignExpression &&