diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-02-11 14:48:54 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-02-11 14:48:54 -0500 |
commit | 43e67019dfc4fb7d3474e0fbedcfec60f2300521 (patch) | |
tree | cf67296a599964c895e443024fe4544bcd54f428 /lisp/emacs-lisp/macroexp.el | |
parent | d779e73c22ae9fedcf6edc6ec286f19cf2e3d89a (diff) | |
download | emacs-43e67019dfc4fb7d3474e0fbedcfec60f2300521.tar.gz emacs-43e67019dfc4fb7d3474e0fbedcfec60f2300521.tar.bz2 emacs-43e67019dfc4fb7d3474e0fbedcfec60f2300521.zip |
Make cconv-analyse understand the need for closures.
* lisp/emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
Understand the :fun-body case for catch, save-window-excursion, and
condition-case.
(byte-compile-maybe-push-heap-environment): No need when nclosures is
zero and byte-compile-current-num-closures is -1.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
renamed to `bytecomp-fun'.
* lisp/emacs-lisp/cconv.el (cconv-not-lexical-var-p): New function.
(cconv-freevars): Use it.
(cconv-closure-convert-rec): Avoid `position'.
(cconv-analyse-function): New function.
(cconv-analyse-form): Use it. `inclosure' can't be nil any more.
Check lexical vars at let-binding time rather than when referenced.
For defuns to be in an empty environment and lambdas to take lexical args.
Pay attention to the need to build closures in catch, unwind-protect,
save-window-excursion, condition-case, and track-mouse.
Fix defconst/defvar handling.
Diffstat (limited to 'lisp/emacs-lisp/macroexp.el')
-rw-r--r-- | lisp/emacs-lisp/macroexp.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index af8047256e2..bccc60a24e0 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -29,6 +29,8 @@ ;;; Code: +(eval-when-compile (require 'cl)) + ;; Bound by the top-level `macroexpand-all', and modified to include any ;; macros defined by `defmacro'. (defvar macroexpand-all-environment nil) @@ -164,6 +166,17 @@ Assumes the caller has bound `macroexpand-all-environment'." (cons (macroexpand-all-1 (list 'function f)) (macroexpand-all-forms args))))) + ;; Macro expand compiler macros. + ;; FIXME: Don't depend on CL. + (`(,(and (pred symbolp) fun + (guard (and (eq (get fun 'byte-compile) + 'cl-byte-compile-compiler-macro) + (functionp 'compiler-macroexpand)))) + . ,_) + (let ((newform (compiler-macroexpand form))) + (if (eq form newform) + (macroexpand-all-forms form 1) + (macroexpand-all-1 newform)))) (`(,_ . ,_) ;; For every other list, we just expand each argument (for ;; setq/setq-default this works alright because the variable names |