summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-08-28 06:51:30 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-08-28 06:51:30 -0700
commit427b3399a9e7b1a03a4475292dd573e28da94680 (patch)
treee8ee71affa5ed4103125d12ba7a2f3cadfbc6d63
parentaa7f00c34df40969e6166b7bfce7c9e3faf04970 (diff)
downloadtxr-427b3399a9e7b1a03a4475292dd573e28da94680.tar.gz
txr-427b3399a9e7b1a03a4475292dd573e28da94680.tar.bz2
txr-427b3399a9e7b1a03a4475292dd573e28da94680.zip
compiler: bugfix: colon keyword bungle in macro params.
When the (set arg :) form is processed by a compiled version of the set operator, it blows up with "set: arguments must be pairs". This is because the compiled destructuring code is wrongly trying to apply special treatment to a colon symbol argument to an optional parameter. It is documented that such such treatment only happens in function calls, and not in the binding of macro parameter lists. Interpreted macro param binding gets it right. * share/txr/stdlib/compiler.tl (expand-bind-mac-params): Do not treat a : element in the structure as a missing optional argument, but as an ordinary value.
-rw-r--r--share/txr/stdlib/compiler.tl16
1 files changed, 7 insertions, 9 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index 280fe753..a4c985e8 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -1419,10 +1419,9 @@
^((set ,curs (or (car ,obj-var)
(sys:upenv ,init-form)))
(cond
- ((and ,obj-var
- (prog1
- (neq (set ,curs (car ,obj-var)) :)
- (set ,obj-var (cdr ,obj-var))))
+ (,obj-var
+ (set ,curs (car ,obj-var))
+ (set ,obj-var (cdr ,obj-var))
,*(if pres-p
^((set ,pres-p t))))
(t
@@ -1434,11 +1433,10 @@
(when pres-p
(push pres-p vars))
^((cond
- ((and ,obj-var
- (prog1
- (neq (set ,p (car ,obj-var)) :)
- (set ,obj-var (cdr ,obj-var))))
- ,*(if pres-p
+ (,obj-var
+ (set ,p (car ,obj-var))
+ (set ,obj-var (cdr ,obj-var))
+ ,*(if pres-p
^((set ,pres-p t))))
(t
,*(if init-form