Mercurial > hg > xemacs-beta
changeset 5612:2c20bc575989
Use the old #'labels implementation if #'lexical-let changes lambdas.
lisp/ChangeLog addition:
2011-12-13 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-initial-macro-environment):
If lexical let has played with our lambas, give up on constructing
the compiled functions at compiled time, that strategy doesn't
work.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 13 Dec 2011 20:28:32 +0000 |
parents | d489e88450aa |
children | a944c124b2d3 |
files | lisp/ChangeLog lisp/bytecomp.el |
diffstat | 2 files changed, 32 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sat Dec 10 16:19:16 2011 +0000 +++ b/lisp/ChangeLog Tue Dec 13 20:28:32 2011 +0000 @@ -3,6 +3,13 @@ * mule/mule-cmds.el (posix-charset-to-coding-system-hash): Correct the docstring for this variable. +2011-12-13 Aidan Kehoe <kehoea@parhasard.net> + + * bytecomp.el (byte-compile-initial-macro-environment): + If lexical let has played with our lambas, give up on constructing + the compiled functions at compiled time, that strategy doesn't + work. + 2011-12-09 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (load-time-value):
--- a/lisp/bytecomp.el Sat Dec 10 16:19:16 2011 +0000 +++ b/lisp/bytecomp.el Tue Dec 13 20:28:32 2011 +0000 @@ -636,9 +636,31 @@ (cons 'progn (byte-compile-transform-labels form names lambdas placeholders)))))) - (cl-macroexpand-all `(,gensym ',names (list ,@lambdas) - ',placeholders ,@body) - byte-compile-macro-environment))))) + (setq body + (cl-macroexpand-all `(,gensym ',names (list ,@lambdas) + ',placeholders ,@body) + byte-compile-macro-environment)) + (if (position 'lambda (mapcar #'(lambda (object) + (car-safe (cdr-safe + object))) + (cdr (third body))) + :key #'car-safe :test-not #'eq) + ;; #'lexical-let has worked its magic, not all the + ;; lambdas are lambdas. Give up on pre-compiling the + ;; labels. + (setq names (mapcar #'copy-symbol names) + lambdas (cdr (third body)) + body (sublis (pairlis placeholders names) + (nthcdr 4 body) :test #'eq) + lambdas (sublis (pairlis placeholders names) + lambdas :test #'eq) + body (cl-macroexpand-all + `(lexical-let + ,names + (setf ,@(mapcan #'list names lambdas)) + ,@body) + byte-compile-macro-environment)) + body))))) (flet . ,#'(lambda (bindings &rest body) (let* ((names (mapcar 'car bindings))