diff options
-rw-r--r-- | SC/Exp.hs | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -91,10 +91,14 @@ compileExp' aenv env = \case A.Pair a b -> do (usedA1, res1) <- compileExp' aenv env a (usedA2, res2) <- compileExp' aenv env b - return (usedA1 ++ usedA2, Left (\case - ITupPair n1 n2 -> toStoring res1 n1 ++ toStoring res2 n2 - ITupIgnore -> [] - ITupSingle _ -> error "wat")) + return (usedA1 ++ usedA2 + ,case (res1, res2) of + (Right (sts1, exp1), Right (sts2, exp2)) -> + Right (sts1 ++ sts2, ITupPair exp1 exp2) + _ -> Left (\case + ITupPair n1 n2 -> toStoring res1 n1 ++ toStoring res2 n2 + ITupIgnore -> [] + ITupSingle _ -> error "wat")) A.Const ty x | Just str <- showExpConst ty x |