1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-07-04 16:29:52 +00:00

Fix for-downto

This commit is contained in:
Karol Stasiak 2019-07-19 15:47:46 +02:00
parent 49d176fb3c
commit ed6d96f3f5

View File

@ -270,7 +270,7 @@ abstract class AbstractStatementCompiler[T <: AbstractCode] {
))
case (ForDirection.DownTo, _, _) =>
// TODO: smarter countdown if end is not a constant
val endMinusOne = SumExpression(List(true -> f.end, false -> LiteralExpression(1, 1)), decimal = false).pos(p)
val endMinusOne = SumExpression(List(false -> f.end, true -> LiteralExpression(1, 1)), decimal = false).pos(p)
compile(ctx, List(
Assignment(vex, f.start).pos(p),
IfStatement(