From ee97af100250652567c2b9bb82a9f34f1c154848 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sun, 7 Aug 2022 15:57:22 -0700 Subject: Fix hoist. Hoist needs to hoist the function bodies as well. --- lib/csc/cps.csc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/csc/cps.csc') 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)) -- cgit v1.3.1