diff options
| author | Gerd Moellmann | 2001-03-26 13:04:11 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-03-26 13:04:11 +0000 |
| commit | aefd695aadf810e2909ca6d7991161658d3b84f5 (patch) | |
| tree | f54b69982f46876558ee23cd5382a604de9e54e5 | |
| parent | 12deffc6f4ab80f135ba9fe22f402a95d01c3109 (diff) | |
| download | emacs-aefd695aadf810e2909ca6d7991161658d3b84f5.tar.gz emacs-aefd695aadf810e2909ca6d7991161658d3b84f5.zip | |
(byte-optimize-while)
(byte-optimize-form-code-walker): Diagnose too few arguments
for `if' and `while'.
| -rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index da695386604..5c713b13449 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler. | 1 | ;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler. |
| 2 | 2 | ||
| 3 | ;;; Copyright (c) 1991, 1994, 2000 Free Software Foundation, Inc. | 3 | ;;; Copyright (c) 1991, 1994, 2000, 2001 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Jamie Zawinski <jwz@lucid.com> | 5 | ;; Author: Jamie Zawinski <jwz@lucid.com> |
| 6 | ;; Hallvard Furuseth <hbf@ulrik.uio.no> | 6 | ;; Hallvard Furuseth <hbf@ulrik.uio.no> |
| @@ -445,6 +445,8 @@ | |||
| 445 | (byte-optimize-body (cdr (cdr form)) for-effect)))) | 445 | (byte-optimize-body (cdr (cdr form)) for-effect)))) |
| 446 | 446 | ||
| 447 | ((eq fn 'if) | 447 | ((eq fn 'if) |
| 448 | (when (< (length form) 3) | ||
| 449 | (byte-compile-warn "Too few arguments for `if'")) | ||
| 448 | (cons fn | 450 | (cons fn |
| 449 | (cons (byte-optimize-form (nth 1 form) nil) | 451 | (cons (byte-optimize-form (nth 1 form) nil) |
| 450 | (cons | 452 | (cons |
| @@ -1014,6 +1016,8 @@ | |||
| 1014 | (list 'progn clause nil))))) | 1016 | (list 'progn clause nil))))) |
| 1015 | 1017 | ||
| 1016 | (defun byte-optimize-while (form) | 1018 | (defun byte-optimize-while (form) |
| 1019 | (when (< (length form) 2) | ||
| 1020 | (byte-compile-warn "Too few arguments for `while'")) | ||
| 1017 | (if (nth 1 form) | 1021 | (if (nth 1 form) |
| 1018 | form)) | 1022 | form)) |
| 1019 | 1023 | ||