]> git.eshelyaron.com Git - emacs.git/commitdiff
Move `while` syntax check from optimiser to macroexpand
authorMattias Engdegård <mattiase@acm.org>
Wed, 17 Aug 2022 18:29:27 +0000 (20:29 +0200)
committerMattias Engdegård <mattiase@acm.org>
Fri, 19 Aug 2022 19:23:48 +0000 (21:23 +0200)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-while): Move check...
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): ...here.

lisp/emacs-lisp/byte-opt.el
lisp/emacs-lisp/macroexp.el

index 1751669445af091fb2d4d29756a4448b9d610648..2467b468a46f0d88ac12163cf5c131fc747b4d44 100644 (file)
@@ -1317,9 +1317,6 @@ See Info node `(elisp) Integer Basics'."
       (list 'progn condition nil)))))
 
 (defun byte-optimize-while (form)
-  ;; FIXME: This check does not belong here, move!
-  (when (< (length form) 2)
-    (byte-compile-warn-x form "too few arguments for `while'"))
   (let ((condition (nth 1 form)))
     (if (byte-compile-nilconstp condition)
         condition
index 40ed0344dfddb129c650acb32cb40d4e3100ab82..c3ba1b36d444021f87bb2dc002a0698d3ec87c63 100644 (file)
@@ -371,6 +371,11 @@ Assumes the caller has bound `macroexpand-all-environment'."
                    (macroexp--all-forms body))
                  (cdr form))
                 form)))
+            (`(while)
+             (macroexp-warn-and-return
+              "missing `while' condition"
+              `(signal 'wrong-number-of-arguments '(while 0))
+              nil 'compile-only form))
             (`(setq ,(and var (pred symbolp)
                           (pred (not booleanp)) (pred (not keywordp)))
                     ,expr)