Mercurial > hg > xemacs-beta
diff lisp/bytecomp.el @ 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 | 4218b56833b3 |
children | a944c124b2d3 |
line wrap: on
line diff
--- 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))