aboutsummaryrefslogtreecommitdiff
path: root/Sjit
diff options
context:
space:
mode:
Diffstat (limited to 'Sjit')
-rw-r--r--Sjit/Compile.icl4
1 files changed, 3 insertions, 1 deletions
diff --git a/Sjit/Compile.icl b/Sjit/Compile.icl
index 55b8ff3..8fd81a2 100644
--- a/Sjit/Compile.icl
+++ b/Sjit/Compile.icl
@@ -156,7 +156,9 @@ where
# args = if (args=:[]) [Int 0] args
= foldM (flip expr) cs (reverse args) >>= \cs -> case get f cs.funs of
Nothing -> Left ("undefined function '" +++ toString f +++ "'")
- Just f -> gen [Pop (length args-1),Call f] cs
+ Just f -> case length args of
+ 1 -> gen [Call f] cs
+ n -> gen [Pop (n-1),Call f] cs
expr (If b t e) cs =
expr b cs >>=
reserve -1 >>= \(jmptrue,cs=:{sp=orgsp}) ->