From 295fb2ac59b66c0e2470325a42c8e58c135ed044 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 11 Feb 2011 17:30:02 -0500 Subject: Let cconv use :fun-body in special forms that need it. * lisp/emacs-lisp/cconv.el (cconv-closure-convert): Drop `toplevel' arg. (cconv-closure-convert-toplevel): Remove. (cconv-lookup-let): New fun. (cconv-closure-convert-rec): Don't bother with defs-are-legal. Use :fun-body to handle special forms that require closing their forms. * lisp/emacs-lisp/bytecomp.el (byte-compile-file-form, byte-compile): Use cconv-closure-convert instead of cconv-closure-convert-toplevel. (byte-compile-lambda, byte-compile-make-closure): * lisp/emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment): Make sure cconv did its job. * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth before using it. * lisp/dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as function argument. --- lisp/emacs-lisp/bytecomp.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index f37d7489e9a..33940ec160e 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -134,7 +134,7 @@ ;; `eval-when-compile' is defined in byte-run.el, so it must come after the ;; preceding load expression. (provide 'bytecomp-preload) -(eval-when-compile (require 'byte-lexbind)) +(eval-when-compile (require 'byte-lexbind nil 'noerror)) ;; The feature of compiling in a specific target Emacs version ;; has been turned off because compile time options are a bad idea. @@ -2240,7 +2240,7 @@ list that represents a doc string reference. bytecomp-handler) (setq form (macroexpand-all form byte-compile-macro-environment)) (if lexical-binding - (setq form (cconv-closure-convert-toplevel form))) + (setq form (cconv-closure-convert form))) (cond ((not (consp form)) (byte-compile-keep-pending form)) ((and (symbolp (car form)) @@ -2592,7 +2592,7 @@ If FORM is a lambda or a macro, byte-compile it as a function." (macroexpand-all fun byte-compile-initial-macro-environment)) (if lexical-binding - (setq fun (cconv-closure-convert-toplevel fun))) + (setq fun (cconv-closure-convert fun))) ;; get rid of the `function' quote added by the `lambda' macro (setq fun (cadr fun)) (setq fun (if macro @@ -2753,7 +2753,8 @@ If FORM is a lambda or a macro, byte-compile it as a function." ;; containing lexical environment are closed over). (and lexical-binding (byte-compile-closure-initial-lexenv-p - byte-compile-lexical-environment))) + byte-compile-lexical-environment) + (error "Should have been handled by cconv"))) (byte-compile-current-heap-environment nil) (byte-compile-current-num-closures 0) (compiled @@ -2791,6 +2792,7 @@ If FORM is a lambda or a macro, byte-compile it as a function." (eq (car-safe code) 'closure)) (defun byte-compile-make-closure (code) + (error "Should have been handled by cconv") ;; A real closure requires that the constant be curried with an ;; environment vector to make a closure object. (if for-effect -- cgit v1.2.3