aboutsummaryrefslogtreecommitdiffstats
path: root/lib/csc/cps.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-08-07 15:57:22 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-08-07 15:57:22 -0700
commitee97af100250652567c2b9bb82a9f34f1c154848 (patch)
treea77ce965fde0802d5b851db1629a9c53d47bd2dc /lib/csc/cps.csc
parentbd9855941c0ff4c877180d2a5fba4f073710fd5b (diff)
downloadchromatopelma-ee97af100250652567c2b9bb82a9f34f1c154848.tar.zst
Fix hoist.
Hoist needs to hoist the function bodies as well.
Diffstat (limited to 'lib/csc/cps.csc')
-rw-r--r--lib/csc/cps.csc6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/csc/cps.csc b/lib/csc/cps.csc
index 4fed47c..65bca89 100644
--- a/lib/csc/cps.csc
+++ b/lib/csc/cps.csc
@@ -54,6 +54,7 @@
(only (csc ir2)
%apply
%branch
+ %closure
%fix
%primitive
%tail
@@ -69,7 +70,6 @@
make-closure
make-fix
make-label
- make-label
make-primitive
make-variable
tail?)
@@ -494,8 +494,10 @@
((% %apply . _) expr)
((% %tail) expr)
((% %fix funs body)
- (set! functions (append funs functions))
+ (set! functions (append (map hoist funs) functions))
(hoist body))
+ ((% %closure name args body)
+ (make-closure name args (hoist body)))
(_ (error "Unexpected form in hoist" expr)))))
(make-fix functions body))