...
This commit is contained in:
@@ -649,10 +649,10 @@ public static class QBEGenerator
|
||||
|
||||
var result = EmitUnwrap(EmitExpression(ifStatement.Condition));
|
||||
_writer.Code($"jnz {result}, {trueLabel}, {falseLabel}");
|
||||
_writer.Code(trueLabel);
|
||||
_writer.WriteLine(trueLabel);
|
||||
EmitBlock(ifStatement.Body);
|
||||
_writer.Code($"jmp {endLabel}");
|
||||
_writer.Code(falseLabel);
|
||||
_writer.WriteLine(falseLabel);
|
||||
if (ifStatement.Else.HasValue)
|
||||
{
|
||||
ifStatement.Else.Value.Match
|
||||
@@ -662,7 +662,7 @@ public static class QBEGenerator
|
||||
);
|
||||
}
|
||||
|
||||
_writer.Code(endLabel);
|
||||
_writer.WriteLine(endLabel);
|
||||
}
|
||||
|
||||
private static void EmitReturn(BoundReturnNode @return)
|
||||
@@ -701,12 +701,12 @@ public static class QBEGenerator
|
||||
_continueLabels.Push(conditionLabel);
|
||||
|
||||
_writer.Code($"jmp {conditionLabel}");
|
||||
_writer.Code(iterationLabel);
|
||||
_writer.WriteLine(iterationLabel);
|
||||
EmitBlock(whileStatement.Body);
|
||||
_writer.Code(conditionLabel);
|
||||
_writer.WriteLine(conditionLabel);
|
||||
var result = EmitUnwrap(EmitExpression(whileStatement.Condition));
|
||||
_writer.Code($"jnz {result}, {iterationLabel}, {endLabel}");
|
||||
_writer.Code(endLabel);
|
||||
_writer.WriteLine(endLabel);
|
||||
|
||||
_continueLabels.Pop();
|
||||
_breakLabels.Pop();
|
||||
|
||||
Reference in New Issue
Block a user