From c239f348e45c18a9771dfc74e2044e8bd8eb0267 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Wed, 24 Apr 2013 22:59:50 +0100 Subject: [PATCH] setq'ing symbol macros --- ecmalisp.lisp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ecmalisp.lisp b/ecmalisp.lisp index 6489407..cdd3a19 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -627,7 +627,7 @@ ((null (cdr pairs)) (error "Odd number of arguments to setf.")) ((null (cddr pairs)) - (let ((place (first pairs)) + (let ((place (ls-macroexpand-1 (first pairs))) (value (second pairs))) (multiple-value-bind (vars vals store-vars writer-form reader-form) (get-setf-expansion place) @@ -1710,12 +1710,16 @@ (defun setq-pair (var val) (let ((b (lookup-in-lexenv var *environment* 'variable))) - (if (and (binding-p b) - (eq (binding-type b) 'variable) - (not (member 'special (binding-declarations b))) - (not (member 'constant (binding-declarations b)))) - (code (binding-value b) " = " (ls-compile val)) - (ls-compile `(set ',var ,val))))) + (cond + ((and b + (eq (binding-type b) 'variable) + (not (member 'special (binding-declarations b))) + (not (member 'constant (binding-declarations b)))) + (code (binding-value b) " = " (ls-compile val))) + ((and b (eq (binding-type b) 'macro)) + (ls-compile `(setf ,var ,val))) + (t + (ls-compile `(set ',var ,val)))))) (define-compilation setq (&rest pairs) @@ -2166,6 +2170,7 @@ `(%js-vset ,var ,new-value) `(%js-vref ,var)))) + ;;; Backquote implementation. ;;; ;;; Author: Guy L. Steele Jr. Date: 27 December 1985 -- 1.7.10.4