Mercurial > hg > xemacs-beta
comparison lisp/bytecomp.el @ 4639:7757334005ae
bytecomp.el: always check code in (interactive SEXP) for sanity
2009-05-29 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-lambda):
Even if we are going to store uncompiled interactive forms in the
compiled-function object, byte compile (and discard) the code, for
the sake of the warnings generated.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 06 Jun 2009 12:59:31 +0100 |
parents | a9f83990e6bf |
children | 8f1ee2d15784 |
comparison
equal
deleted
inserted
replaced
4638:5bbff3553494 | 4639:7757334005ae |
---|---|
2539 (prog1 (car body) | 2539 (prog1 (car body) |
2540 ;; Discard the doc string | 2540 ;; Discard the doc string |
2541 ;; only if it is not the only element of the body. | 2541 ;; only if it is not the only element of the body. |
2542 (if (cdr body) | 2542 (if (cdr body) |
2543 (setq body (cdr body)))))) | 2543 (setq body (cdr body)))))) |
2544 (int (assq 'interactive body))) | 2544 (int (assq 'interactive body)) compiled-int) |
2545 (dolist (arg arglist) | 2545 (dolist (arg arglist) |
2546 (cond ((not (symbolp arg)) | 2546 (cond ((not (symbolp arg)) |
2547 (byte-compile-warn "non-symbol in arglist: %S" arg)) | 2547 (byte-compile-warn "non-symbol in arglist: %S" arg)) |
2548 ((byte-compile-constant-symbol-p arg) | 2548 ((byte-compile-constant-symbol-p arg) |
2549 (byte-compile-warn "constant symbol in arglist: %s" arg)) | 2549 (byte-compile-warn "constant symbol in arglist: %s" arg)) |
2558 (setq body (cdr body))) | 2558 (setq body (cdr body))) |
2559 (cond ((consp (cdr int)) | 2559 (cond ((consp (cdr int)) |
2560 (if (cdr (cdr int)) | 2560 (if (cdr (cdr int)) |
2561 (byte-compile-warn "malformed interactive spec: %s" | 2561 (byte-compile-warn "malformed interactive spec: %s" |
2562 (prin1-to-string int))) | 2562 (prin1-to-string int))) |
2563 ;; If the interactive spec is a call to `list', | 2563 ;; If the interactive spec is a call to `list', don't |
2564 ;; don't compile it, because `call-interactively' | 2564 ;; store the compiled form, because `call-interactively' |
2565 ;; looks at the args of `list'. | 2565 ;; looks at the args of `list' and treats certain |
2566 ;; functions specially. Compiling it is nonetheless | |
2567 ;; useful for warnings. | |
2566 (let ((form (nth 1 int))) | 2568 (let ((form (nth 1 int))) |
2567 (while (or (eq (car-safe form) 'let) | 2569 (while (or (eq (car-safe form) 'let) |
2568 (eq (car-safe form) 'let*) | 2570 (eq (car-safe form) 'let*) |
2569 (eq (car-safe form) 'save-excursion)) | 2571 (eq (car-safe form) 'save-excursion)) |
2570 (while (consp (cdr form)) | 2572 (while (consp (cdr form)) |
2571 (setq form (cdr form))) | 2573 (setq form (cdr form))) |
2572 (setq form (car form))) | 2574 (setq form (car form))) |
2575 (setq compiled-int | |
2576 (byte-compile-top-level (nth 1 int))) | |
2573 (or (eq (car-safe form) 'list) | 2577 (or (eq (car-safe form) 'list) |
2574 (setq int (list 'interactive | 2578 (setq int (list 'interactive compiled-int))))) |
2575 (byte-compile-top-level (nth 1 int))))))) | |
2576 ((cdr int) | 2579 ((cdr int) |
2577 (byte-compile-warn "malformed interactive spec: %s" | 2580 (byte-compile-warn "malformed interactive spec: %s" |
2578 (prin1-to-string int)))))) | 2581 (prin1-to-string int)))))) |
2579 (let ((compiled (byte-compile-top-level (cons 'progn body) nil 'lambda))) | 2582 (let ((compiled (byte-compile-top-level (cons 'progn body) nil 'lambda))) |
2580 (if (memq 'unused-vars byte-compile-warnings) | 2583 (if (memq 'unused-vars byte-compile-warnings) |