aboutsummaryrefslogtreecommitdiff
path: root/src/Compiler.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-08-14 08:02:47 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-08-14 08:02:47 +0100
commit646e018c9f09bb122b7fa1d9270f6cfc6bd06dd7 (patch)
treee93985f5775630a6e986e12793650e1a18c378be /src/Compiler.hs
parent64880a4e1fc756ad2e2bb818356b9b3e9ba3c402 (diff)
downloadmicro-lang-hs-646e018c9f09bb122b7fa1d9270f6cfc6bd06dd7.tar.gz
micro-lang-hs-646e018c9f09bb122b7fa1d9270f6cfc6bd06dd7.zip
Return the type of the function
This makes lambda calls work.
Diffstat (limited to 'src/Compiler.hs')
-rw-r--r--src/Compiler.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Compiler.hs b/src/Compiler.hs
index e69ab77..c8889b6 100644
--- a/src/Compiler.hs
+++ b/src/Compiler.hs
@@ -38,7 +38,7 @@ compile x = do
(ev, errs) <- get
-- updated with the function
(ev, errs) <-
- return $ case addSymUniq ev (ident, A.toFuncType params ret, pos) of
+ return $ case addSymUniq ev (ident, ftype, pos) of
Left err -> (ev, err : errs)
Right ev -> (ev, errs)
-- with parameters
@@ -48,7 +48,9 @@ compile x = do
(_, errs) <- get
-- store updated errors and the env with the function
put (ev, errs)
- return $ r
+ return $ Right $ Just ftype
+ where
+ ftype = A.toFuncType params ret
(A.Call ident args pos) -> do
r <- compile ident
case r of