From: David Vázquez Date: Wed, 24 Apr 2013 21:59:50 +0000 (+0100) Subject: setq'ing symbol macros X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=c239f348e45c18a9771dfc74e2044e8bd8eb0267;p=jscl.git setq'ing symbol macros --- 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