comparison lisp/bytecomp.el @ 5548:b90c153730c7

Do the quoted-lambda check when functions take :if, :test, :key arguments, too. lisp/ChangeLog addition: 2011-08-10 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-normal-call): When a function takes :if, :if-not, :test, :test-not or :key arguments, do the quoted-lambda check there too.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 10 Aug 2011 15:55:53 +0100
parents b0d87f92e60b
children 58b38d5b32d0
comparison
equal deleted inserted replaced
5547:a46c5c8d6564 5548:b90c153730c7
2878 (and 2878 (and
2879 (memq 'callargs byte-compile-warnings) 2879 (memq 'callargs byte-compile-warnings)
2880 (map nil 2880 (map nil
2881 (function* 2881 (function*
2882 (lambda ((function . nargs)) 2882 (lambda ((function . nargs))
2883 (and (setq function (plist-get plist function 2883 (let ((value (plist-get plist function not-present)))
2884 not-present)) 2884 (when (and (not (eq value not-present))
2885 (not (eq function not-present)) 2885 (byte-compile-constp value))
2886 (byte-compile-constp function) 2886 (byte-compile-callargs-warn
2887 (byte-compile-callargs-warn 2887 (cons (eval value)
2888 (cons (eval function) 2888 (member*
2889 (member* 2889 nargs
2890 nargs 2890 ;; Dummy arguments. There's no need for
2891 ;; Dummy arguments. There's no need for 2891 ;; it to be longer than even 2, now, but
2892 ;; it to be longer than even 2, now, but 2892 ;; very little harm in it.
2893 ;; very little harm in it. 2893 '(9 8 7 6 5 4 3 2 1))))
2894 '(9 8 7 6 5 4 3 2 1))))))) 2894 (when (and (eq (car-safe value) 'quote)
2895 '((:key . 1) (:test . 2) (:test-not . 2) 2895 (eq (car-safe (nth 1 value)) 'lambda)
2896 (:if . 1) (:if-not . 1)))))))) 2896 (or
2897 (null (memq 'quoted-lambda
2898 byte-compile-warnings))
2899 (byte-compile-warn
2900 "Passing a quoted lambda to #'%s, \
2901 keyword %s, forcing function quoting" (car form) function)))
2902 (setcar value 'function))))))
2903 '((:key . 1) (:test . 2) (:test-not . 2) (:if . 1)
2904 (:if-not . 1))))))))
2897 (if byte-compile-generate-call-tree 2905 (if byte-compile-generate-call-tree
2898 (byte-compile-annotate-call-tree form)) 2906 (byte-compile-annotate-call-tree form))
2899 (byte-compile-push-constant (car form)) 2907 (byte-compile-push-constant (car form))
2900 (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster. 2908 (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster.
2901 (byte-compile-out 'byte-call (length (cdr form)))) 2909 (byte-compile-out 'byte-call (length (cdr form))))