emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9a7b3673e0: Move `while` syntax check from optimiser to macroexpa


From: Mattias Engdegård
Subject: master 9a7b3673e0: Move `while` syntax check from optimiser to macroexpand
Date: Fri, 19 Aug 2022 15:24:36 -0400 (EDT)

branch: master
commit 9a7b3673e09fe839163bf35e25e37e2ac62bc272
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Move `while` syntax check from optimiser to macroexpand
    
    * 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 | 3 ---
 lisp/emacs-lisp/macroexp.el | 5 +++++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 1751669445..2467b468a4 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -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
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 40ed0344df..c3ba1b36d4 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]