summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorIgor Kuzmin <kuzminig@iro.umontreal.ca>2011-02-10 13:53:49 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-02-10 13:53:49 -0500
commit94d11cb5773b3b37367ee3c4885a374ff129d475 (patch)
treeb7acbbd87cfce602ad52c23f4434a3b27eac83e1 /lisp/emacs-lisp/bytecomp.el
parent8f1d2ef658f95549eb33fe5265f8f11c5129bece (diff)
downloademacs-94d11cb5773b3b37367ee3c4885a374ff129d475.tar.gz
* lisp/emacs-lisp/cconv.el: New file.
* lisp/emacs-lisp/bytecomp.el: Use cconv. (byte-compile-file-form, byte-compile): Call cconv-closure-convert-toplevel when requested. * lisp/server.el: * lisp/mpc.el: * lisp/emacs-lisp/pcase.el: * lisp/doc-view.el: * lisp/dired.el: Use lexical-binding.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index be3e1ed617c..b258524b45f 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -119,6 +119,7 @@
(require 'backquote)
(require 'macroexp)
+(require 'cconv)
(eval-when-compile (require 'cl))
(or (fboundp 'defsubst)
@@ -2238,6 +2239,8 @@ list that represents a doc string reference.
(let ((byte-compile-current-form nil) ; close over this for warnings.
bytecomp-handler)
(setq form (macroexpand-all form byte-compile-macro-environment))
+ (if lexical-binding
+ (setq form (cconv-closure-convert-toplevel form)))
(cond ((not (consp form))
(byte-compile-keep-pending form))
((and (symbolp (car form))
@@ -2585,9 +2588,11 @@ If FORM is a lambda or a macro, byte-compile it as a function."
(setq fun (cdr fun)))
(cond ((eq (car-safe fun) 'lambda)
;; expand macros
- (setq fun
- (macroexpand-all fun
- byte-compile-initial-macro-environment))
+ (setq fun
+ (macroexpand-all fun
+ byte-compile-initial-macro-environment))
+ (if lexical-binding
+ (setq fun (cconv-closure-convert-toplevel fun)))
;; get rid of the `function' quote added by the `lambda' macro
(setq fun (cadr fun))
(setq fun (if macro