Commit 295fb2ac authored by Stefan Monnier's avatar Stefan Monnier
Browse files

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.
parent 43e67019
2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
* 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.
* 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):
* emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment):
Make sure cconv did its job.
* emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
before using it.
* dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
function argument.
2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
......
;;; -*- lexical-binding: t -*-
;;; dired.el --- directory-browsing commands
;;; dired.el --- directory-browsing commands -*- lexical-binding: t -*-
;; Copyright (C) 1985-1986, 1992-1997, 2000-2011
;; Free Software Foundation, Inc.
......@@ -3507,21 +3506,21 @@ Ask means pop up a menu for the user to select one of copy, move or link."
(eval-when-compile (require 'desktop))
(defun dired-desktop-buffer-misc-data (desktop-dirname)
(defun dired-desktop-buffer-misc-data (dirname)
"Auxiliary information to be saved in desktop file."
(cons
;; Value of `dired-directory'.
(if (consp dired-directory)
;; Directory name followed by list of files.
(cons (desktop-file-name (car dired-directory) desktop-dirname)
(cons (desktop-file-name (car dired-directory) dirname)
(cdr dired-directory))
;; Directory name, optionally with shell wildcard.
(desktop-file-name dired-directory desktop-dirname))
(desktop-file-name dired-directory dirname))
;; Subdirectories in `dired-subdir-alist'.
(cdr
(nreverse
(mapcar
(function (lambda (f) (desktop-file-name (car f) desktop-dirname)))
(function (lambda (f) (desktop-file-name (car f) dirname)))
dired-subdir-alist)))))
(defun dired-restore-desktop-buffer (desktop-buffer-file-name
......
......@@ -585,6 +585,7 @@ proper scope)."
(= nclosures byte-compile-current-num-closures))
;; No need to push a heap environment.
nil
(error "Should have been handled by cconv")
;; Have to push one. A heap environment is really just a vector, so
;; we emit bytecodes to create a vector. However, the size is not
;; fixed yet (the vector can grow if subforms use it to store
......
......@@ -1863,7 +1863,7 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
;;
;; stack-ref-N --> dup ; where N is TOS
;;
((and (eq (car lap0) 'byte-stack-ref)
((and stack-depth (eq (car lap0) 'byte-stack-ref)
(= (cdr lap0) (1- stack-depth)))
(setcar lap0 'byte-dup)
(setcdr lap0 nil)
......@@ -2093,7 +2093,8 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
;; stack-set-M [discard/discardN ...] --> discardN-preserve-tos
;; stack-set-M [discard/discardN ...] --> discardN
;;
((and (eq (car lap0) 'byte-stack-set)
((and stack-depth ;Make sure we know the stack depth.
(eq (car lap0) 'byte-stack-set)
(memq (car lap1) '(byte-discard byte-discardN))
(progn
;; See if enough discard operations follow to expose or
......@@ -2161,7 +2162,8 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
;; dup return --> return
;; stack-set-N return --> return ; where N is TOS-1
;;
((and (eq (car lap1) 'byte-return)
((and stack-depth ;Make sure we know the stack depth.
(eq (car lap1) 'byte-return)
(or (memq (car lap0) '(byte-discardN-preserve-tos byte-dup))
(and (eq (car lap0) 'byte-stack-set)
(= (cdr lap0) (- stack-depth 2)))))
......@@ -2174,7 +2176,8 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
;;
;; dup stack-set-N return --> return ; where N is TOS
;;
((and (eq (car lap0) 'byte-dup)
((and stack-depth ;Make sure we know the stack depth.
(eq (car lap0) 'byte-dup)
(eq (car lap1) 'byte-stack-set)
(eq (car (car (cdr (cdr rest)))) 'byte-return)
(= (cdr lap1) (1- stack-depth)))
......
......@@ -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
......
This diff is collapsed.
;;; -*- lexical-binding: t -*-
;;; mpc.el --- A client for the Music Player Daemon -*- coding: utf-8 -*-
;;; mpc.el --- A client for the Music Player Daemon -*- coding: utf-8; lexical-binding: t -*-
;; Copyright (C) 2006-2011 Free Software Foundation, Inc.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment