From 2970e33cf1cf28bd091133e620008f9764993e64 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 27 Mar 2018 06:41:40 -0700 Subject: compiler: bugfix in sys:fbind op. When a (flet ...) form is compiled, the function arguments of the lambda are being bound in the same frame and clashing against the variables being bound by the construct. * share/txr/stdlib/compiler.tl (compiler comp-fbind): For the non-recursive case, insert the dummy empty environment eenv, and compile the forms in that environment. This raises them up to the appropriate display level without affecting what is visible in their scope. --- share/txr/stdlib/compiler.tl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 7418ac93..17428eee 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -576,6 +576,7 @@ (lexfuns [mapcar car fis]) (frsize (len lexfuns)) (rec (eq sym 'sys:lbind)) + (eenv (unless rec (new env up env co me))) (nenv (new env up env co me))) (each ((lfun lexfuns)) nenv.(extend-fun lfun)) @@ -586,7 +587,7 @@ (tree-bind (sym : form) fi (let* ((bind nenv.(lookup-fun sym)) (frag me.(compile bind.loc - (if rec nenv env) + (if rec nenv eenv) form))) (pend frag.code (maybe-mov bind.loc frag.oreg)) -- cgit v1.2.3