mirror of
https://git.tesses.org/tesses50/crosslang.git
synced 2026-09-30 08:44:14 +00:00
Fix ternary
This commit is contained in:
@@ -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 &&
|
||||||
|
|||||||
Reference in New Issue
Block a user