comparison 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
comparison
equal deleted inserted replaced
5611:d489e88450aa 5612:2c20bc575989
634 (placeholders (cadr (pop form)))) 634 (placeholders (cadr (pop form))))
635 (byte-compile-file-form 635 (byte-compile-file-form
636 (cons 'progn 636 (cons 'progn
637 (byte-compile-transform-labels 637 (byte-compile-transform-labels
638 form names lambdas placeholders)))))) 638 form names lambdas placeholders))))))
639 (cl-macroexpand-all `(,gensym ',names (list ,@lambdas) 639 (setq body
640 ',placeholders ,@body) 640 (cl-macroexpand-all `(,gensym ',names (list ,@lambdas)
641 byte-compile-macro-environment))))) 641 ',placeholders ,@body)
642 byte-compile-macro-environment))
643 (if (position 'lambda (mapcar #'(lambda (object)
644 (car-safe (cdr-safe
645 object)))
646 (cdr (third body)))
647 :key #'car-safe :test-not #'eq)
648 ;; #'lexical-let has worked its magic, not all the
649 ;; lambdas are lambdas. Give up on pre-compiling the
650 ;; labels.
651 (setq names (mapcar #'copy-symbol names)
652 lambdas (cdr (third body))
653 body (sublis (pairlis placeholders names)
654 (nthcdr 4 body) :test #'eq)
655 lambdas (sublis (pairlis placeholders names)
656 lambdas :test #'eq)
657 body (cl-macroexpand-all
658 `(lexical-let
659 ,names
660 (setf ,@(mapcan #'list names lambdas))
661 ,@body)
662 byte-compile-macro-environment))
663 body)))))
642 (flet . 664 (flet .
643 ,#'(lambda (bindings &rest body) 665 ,#'(lambda (bindings &rest body)
644 (let* ((names (mapcar 'car bindings)) 666 (let* ((names (mapcar 'car bindings))
645 (lambdas (mapcar 667 (lambdas (mapcar
646 (function* 668 (function*