cd8d7748199
authorDebian Games Team <pkg-games-devel@lists.alioth.debian.org>
Wed, 19 Oct 2022 09:40:18 +0000 (10:40 +0100)
committerGianfranco Costamagna <locutusofborg@debian.org>
Wed, 19 Oct 2022 09:40:18 +0000 (10:40 +0100)
# HG changeset patch
# User alfadur
# Date 1663731365 -10800
# Node ID 9cd8d7748199d732cf7e5b0b245f1159bc86f0ea
# Parent  f550a79274fab200e07209edeb9291c06041af19
fix pred/succ conversion

Gbp-Pq: Name 9cd8d7748199.patch

tools/pas2c/Pas2C.hs

index c7a8c969f41ca626ca48b2fb782dd3db353171e9..ddb8a21a0eadb4b3290f7e8d2a90ff3ddf061190 100644 (file)
@@ -711,8 +711,8 @@ initExpr2C' hi@(BuiltInFunction "high" [e@(InitReference e')]) = do
          a -> error $ "BuiltInFunction 'high' in initExpr: " ++ show a ++ ": " ++ show hi
 initExpr2C' (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C' e
 initExpr2C' (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C' e
-initExpr2C' (BuiltInFunction "succ" [e]) = liftM (<> text " + 1") $ initExpr2C' e
-initExpr2C' (BuiltInFunction "pred" [e]) = liftM (<> text " - 1") $ initExpr2C' e
+initExpr2C' (BuiltInFunction "succ" [e]) = liftM (\e' ->  text "(" <> e' <> text " + 1)") $ initExpr2C' e
+initExpr2C' (BuiltInFunction "pred" [e]) = liftM (\e' ->  text "(" <> e' <> text " - 1)") $ initExpr2C' e
 initExpr2C' b@(BuiltInFunction _ _) = error $ show b
 initExpr2C' (InitTypeCast t' i) = do
     e <- initExpr2C i