From e99c890b7bdd54dbbb83d25c3e9adb2f95c960c7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 7 Aug 2019 23:28:23 -0700 Subject: compiler: bugfix: scoping issue in inline lambda. * share/txr/stdlib/compiler.tl (lambda-apply-transform): The gensym for binding the trailing argument expression must be bound before any of the parameters, otherwise the expression is exposed to the scope of the parameters that have been emitted so far. We use add* to put it at the front. --- share/txr/stdlib/compiler.tl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 4bf56c31..485d83be 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -1522,7 +1522,7 @@ ((and fix-arg-exprs apply-list-expr) (lambda-too-many-args lm-expr)) (apply-list-expr - (add ^(,al-val ,apply-list-expr)) + (add* ^(,al-val ,apply-list-expr)) (when pars.req (add ^(,ign-sym (if (< (len ,al-val) ,(len pars.req)) (lambda-short-apply-list))))) -- cgit v1.2.3