aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-11 20:37:31 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-11 20:37:31 +0100
commit230276c8a3e45a0079232739976e117db2d26b00 (patch)
tree32408f3ccab77059c00f79c7de32d23b367d2f6f
parent0a49f4e86d61c14e2d457e03cb56c65c764d8e55 (diff)
downloadmicro-lang-hs-230276c8a3e45a0079232739976e117db2d26b00.tar.gz
micro-lang-hs-230276c8a3e45a0079232739976e117db2d26b00.zip
More folding
-rw-r--r--src/Micro/Compiler.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Micro/Compiler.hs b/src/Micro/Compiler.hs
index 3899ead..6d2a35d 100644
--- a/src/Micro/Compiler.hs
+++ b/src/Micro/Compiler.hs
@@ -188,6 +188,9 @@ foldConstant x =
if newOp /= x then foldConstant newOp else newOp
(A.Func ident params ret body priv anon pos) ->
A.Func ident params ret (map foldConstant body) priv anon pos
+ (A.Call ident args pos) ->
+ A.Call (foldConstant ident) (map foldConstant args) pos
+ (A.Var ident typ val priv pos) -> A.Var ident typ (foldConstant val) priv pos
(A.Return value pos) -> A.Return (fmap foldConstant value) pos
_ -> x