Bugfix: else assembly
This commit is contained in:
parent
c02de8f9b2
commit
a4fff37b07
@ -231,7 +231,8 @@ assembleStatement (constants, ops) (TypedStatement _ (If expr if_stmt else_stmt)
|
||||
Just stmt -> assembleStatement (constants_ifa, []) stmt
|
||||
-- +6 because we insert 2 gotos, one for if, one for else
|
||||
if_length = sum (map opcodeEncodingLength ops_ifa) + 6
|
||||
else_length = sum (map opcodeEncodingLength ops_ifa)
|
||||
-- +3 because we need to account for the goto in the if statement.
|
||||
else_length = sum (map opcodeEncodingLength ops_elsea) + 3
|
||||
in
|
||||
(constants_ifa, ops ++ ops_cmp ++ [Opsipush 0, Opif_icmpeq if_length] ++ ops_ifa ++ [Opgoto else_length] ++ ops_elsea)
|
||||
assembleStatement stmt _ = error ("Not yet implemented: " ++ show stmt)
|
||||
|
Loading…
Reference in New Issue
Block a user