comparison lisp/cl.el @ 5462:97ac18bd1fa3

Make sure distinct symbol macros with identical names expand distinctly. lisp/ChangeLog addition: 2011-04-24 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (symbol-macrolet): * cl-macs.el (lexical-let): * cl.el: * cl.el (cl-macroexpand): Distinct symbol macros with identical string names should nonetheless expand to different things; implement this, storing the symbol's eq-hash in the macro environment, rather than its string name. tests/ChangeLog addition: 2011-04-24 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Check that distinct symbol macros with identical string names expand to different things.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 24 Apr 2011 09:52:45 +0100
parents 25c10648ffba
children f2881cb841b4
comparison
equal deleted inserted replaced
5461:568ec109e73d 5462:97ac18bd1fa3
227 Otherwise, the macro is expanded and the expansion is considered 227 Otherwise, the macro is expanded and the expansion is considered
228 in place of FORM. When a non-macro-call results, it is returned. 228 in place of FORM. When a non-macro-call results, it is returned.
229 229
230 The second optional arg ENVIRONMENT specifies an environment of macro 230 The second optional arg ENVIRONMENT specifies an environment of macro
231 definitions to shadow the loaded ones for use in file byte-compilation." 231 definitions to shadow the loaded ones for use in file byte-compilation."
232 (let ((cl-macro-environment cl-env)) 232 (let ((cl-macro-environment
233 (while (progn (setq cl-macro (funcall cl-old-macroexpand cl-macro cl-env)) 233 (if cl-macro-environment (append cl-env cl-macro-environment) cl-env))
234 eq-hash)
235 (while (progn (setq cl-macro
236 (macroexpand-internal cl-macro cl-macro-environment))
234 (and (symbolp cl-macro) 237 (and (symbolp cl-macro)
235 (cdr (assq (symbol-name cl-macro) cl-env)))) 238 (setq eq-hash (eq-hash cl-macro))
236 (setq cl-macro (cadr (assq (symbol-name cl-macro) cl-env)))) 239 (if (fixnump eq-hash)
240 (assq eq-hash cl-macro-environment)
241 (assoc eq-hash cl-macro-environment))))
242 (setq cl-macro (cadr (assoc* eq-hash cl-macro-environment))))
237 cl-macro)) 243 cl-macro))
238 244
239 ;;; Declarations. 245 ;;; Declarations.
240 246
241 (defvar cl-compiling-file nil) 247 (defvar cl-compiling-file nil)