branch: elpa/flycheck
commit 36741d8df56feb520c3228f45d156be143f9976c
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Document why flycheck--rx-expand uses custom tree-walking
Explain that rx-define/rx-let can't handle optional arguments
with defaults, which is needed for forms like (file-name) vs
(file-name SEXP ...).
---
flycheck.el | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/flycheck.el b/flycheck.el
index e51aed141f..b4ce51b213 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -1573,6 +1573,12 @@ Safely delete all files and directories listed in
(seq-do #'flycheck-safe-delete flycheck-temporaries)
(setq flycheck-temporaries nil))
+;; We use a custom tree-walking expander instead of `rx-define' or
+;; `rx-let' because those don't support optional arguments with
+;; defaults. For example, `(file-name)' should use a default body
+;; while `(file-name SEXP ...)' uses a custom one — this conditional
+;; logic cannot be expressed with `rx-define's parameter mechanism,
+;; which only supports required args and `&rest'.
(defun flycheck--rx-expand (form)
"Expand Flycheck-specific rx constructs in FORM.