diff options
author | Camil Staps | 2018-12-25 02:04:48 +0100 |
---|---|---|
committer | Camil Staps | 2018-12-25 02:04:48 +0100 |
commit | ebd62b387d77502f685fcacbb701adc1cdce26a7 (patch) | |
tree | 6126c14bcee89a2d657cdb9ee8c57f013824d71c /Sjit | |
parent | Add if construct; fib example (diff) |
Don't generate pop 0
Diffstat (limited to 'Sjit')
-rw-r--r-- | Sjit/Compile.icl | 4 |
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}) -> |