Fixed IfStmt

master
Apoorva Ranade 4 years ago
parent 08ddb39134
commit 3ef2df7136

@ -589,11 +589,11 @@ public class CodeGenImpl extends CodeGenBase
Register result = node.condition.dispatch(this);
Label ln = generateLocalLabel();
backend.emitBEQZ(result, ln,"Jump to end of loop");
elseBlock.push(generateLocalLabel());
backend.emitBEQZ(result, elseBlock.peek(),"Jump to end of loop");
for(Stmt s:node.thenBody)
s.dispatch(this);
backend.emitJ(ln, "Jump to end of if statement");
elseBlock.push(generateLocalLabel());
backend.emitLocalLabel(elseBlock.peek(), "Else part of if statement");
for(Stmt s:node.elseBody)
s.dispatch(this);

Loading…
Cancel
Save