summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-03-27 06:41:40 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-03-27 06:41:40 -0700
commit2970e33cf1cf28bd091133e620008f9764993e64 (patch)
tree8e7dbb7573720e4cfc6ec255ace31d31e28eff0e
parentb4045996e6ba899a982561d38467f3f118624a12 (diff)
downloadtxr-2970e33cf1cf28bd091133e620008f9764993e64.tar.gz
txr-2970e33cf1cf28bd091133e620008f9764993e64.tar.bz2
txr-2970e33cf1cf28bd091133e620008f9764993e64.zip
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.
-rw-r--r--share/txr/stdlib/compiler.tl3
1 files changed, 2 insertions, 1 deletions
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))