Changeset 5599


Ignore:
Timestamp:
Dec 6, 2006, 4:05:11 PM (18 years ago)
Author:
Gary Byers
Message:

DEFINE-COMPILER-MACRO: if a SETF name, use the right symbol for the named
block.

COMPILER-MACRO-FUNCTION, (SETF COMPILER-MACRO-FUNCTION): deal with
(SETF NAME).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/compiler/nx0.lisp

    r5573 r5599  
    200200(defmacro define-compiler-macro  (name arglist &body body &environment env)
    201201  "Define a compiler-macro for NAME."
    202   (setq name (validate-function-name name))
    203   (let ((body (parse-macro-1 name arglist body env)))
    204     `(eval-when (:compile-toplevel :load-toplevel :execute)
    205        (setf (compiler-macro-function ',name)
    206              (nfunction (compiler-macro-function ,name) ,body))         
    207        ',name)))
     202  (let* ((block-name name)
     203         (def-name (validate-function-name name)))
     204    (unless (eq def-name block-name)
     205      (setq block-name (cadr block-name)))
     206    (let ((body (parse-macro-1 block-name arglist body env)))
     207      `(eval-when (:compile-toplevel :load-toplevel :execute)
     208        (setf (compiler-macro-function ',name)
     209         (nfunction (compiler-macro-function ,name)  ,body))
     210        ',name))))
    208211
    209212;;; This is silly (as may be the whole idea of actually -using- compiler-macros).
     
    236239  "If NAME names a compiler-macro in ENV, return the expansion function, else
    237240   return NIL. Can be set with SETF when ENV is NIL."
     241  (setq name (validate-function-name name))
    238242  (unless (nx-lexical-finfo name env)
    239243    (or (cdr (assq name *nx-compile-time-compiler-macros*))
     
    241245
    242246(defun set-compiler-macro-function (name def)
    243   (unless (symbolp name) (report-bad-arg name 'symbol))
     247  (setq name (validate-function-name name))
    244248  (if def
    245249    (setf (gethash name *compiler-macros*) def)
Note: See TracChangeset for help on using the changeset viewer.