comparison lisp/emacs-lisp/bytecomp.el @ 86177:fadd23918501

(byte-compile-declare-function): New function, byte-hunk-handler for declare-function. (byte-compile-callargs-warn): Handle declared functions.
author Glenn Morris <rgm@gnu.org>
date Sat, 17 Nov 2007 03:46:23 +0000
parents e33327200372
children 4aed8a9fb626
comparison
equal deleted inserted replaced
86176:55bc44bcdff4 86177:fadd23918501
1256 (defun byte-compile-callargs-warn (form) 1256 (defun byte-compile-callargs-warn (form)
1257 (let* ((def (or (byte-compile-fdefinition (car form) nil) 1257 (let* ((def (or (byte-compile-fdefinition (car form) nil)
1258 (byte-compile-fdefinition (car form) t))) 1258 (byte-compile-fdefinition (car form) t)))
1259 (sig (if (and def (not (eq def t))) 1259 (sig (if (and def (not (eq def t)))
1260 (byte-compile-arglist-signature 1260 (byte-compile-arglist-signature
1261 (if (eq 'lambda (car-safe def)) 1261 (if (memq (car-safe def) '(declared lambda))
1262 (nth 1 def) 1262 (nth 1 def)
1263 (if (byte-code-function-p def) 1263 (if (byte-code-function-p def)
1264 (aref def 0) 1264 (aref def 0)
1265 '(&rest def)))) 1265 '(&rest def))))
1266 (if (and (fboundp (car form)) 1266 (if (and (fboundp (car form))
2815 (setq body (byte-compile-top-level (cons 'progn body) for-effect t)) 2815 (setq body (byte-compile-top-level (cons 'progn body) for-effect t))
2816 (cond ((eq (car-safe body) 'progn) 2816 (cond ((eq (car-safe body) 'progn)
2817 (cdr body)) 2817 (cdr body))
2818 (body 2818 (body
2819 (list body)))) 2819 (list body))))
2820
2821 (put 'declare-function 'byte-hunk-handler 'byte-compile-declare-function)
2822 (defun byte-compile-declare-function (form)
2823 (push (cons (nth 1 form)
2824 (if (< (length form) 4) ; arglist not specified
2825 t
2826 (list 'declared (nth 3 form))))
2827 byte-compile-function-environment)
2828 nil)
2829
2820 2830
2821 ;; This is the recursive entry point for compiling each subform of an 2831 ;; This is the recursive entry point for compiling each subform of an
2822 ;; expression. 2832 ;; expression.
2823 ;; If for-effect is non-nil, byte-compile-form will output a byte-discard 2833 ;; If for-effect is non-nil, byte-compile-form will output a byte-discard
2824 ;; before terminating (ie no value will be left on the stack). 2834 ;; before terminating (ie no value will be left on the stack).