Mercurial > hg > xemacs-beta
comparison lisp/bytecomp.el @ 5613:a944c124b2d3
Be more careful about what we shadow, #'byte-compile-eval.
2011-12-13 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-eval):
When evaluating code at compile time, don't put those macros in
the macro environment that only make sense when creating
byte-compiled output.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 13 Dec 2011 20:42:30 +0000 |
parents | 2c20bc575989 |
children | bd80d9103fc8 |
comparison
equal
deleted
inserted
replaced
5612:2c20bc575989 | 5613:a944c124b2d3 |
---|---|
453 ;;; This helps implement the promise made in the Lispref: | 453 ;;; This helps implement the promise made in the Lispref: |
454 ;;; | 454 ;;; |
455 ;;; "If a file being compiled contains a `defmacro' form, the macro is | 455 ;;; "If a file being compiled contains a `defmacro' form, the macro is |
456 ;;; defined temporarily for the rest of the compilation of that file." | 456 ;;; defined temporarily for the rest of the compilation of that file." |
457 (defun byte-compile-eval (form) | 457 (defun byte-compile-eval (form) |
458 (let ((save-macro-environment nil)) | 458 (let ((save-macro-environment nil) |
459 ;; These are macros in byte-compile-initial-macro-environment that | |
460 ;; shouldn't be shadowed when calling #'byte-compile-eval, since | |
461 ;; such code is interpreted, not compiled. | |
462 ;; #### Consider giving this a docstring and a top-level value. | |
463 (byte-compile-no-shadow '(load-time-value labels flet))) | |
459 (unwind-protect | 464 (unwind-protect |
460 (loop | 465 (loop |
461 for (sym . def) in byte-compile-macro-environment | 466 for (sym . def) in byte-compile-macro-environment |
462 do (when (symbolp sym) | 467 do (when (and (symbolp sym) (not (memq sym byte-compile-no-shadow))) |
463 (push | 468 (push |
464 (if (fboundp sym) | 469 (if (fboundp sym) |
465 (cons sym (symbol-function sym)) | 470 (cons sym (symbol-function sym)) |
466 sym) | 471 sym) |
467 save-macro-environment) | 472 save-macro-environment) |