HS: remove .class from .coll when it matches .filter
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 19s

Parser produces remove-class-when AST node; compiler emits
filter + for-each pattern matching add-class-when.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-27 02:48:27 +00:00
parent c4d9efc8c4
commit eef2bfdd89
4 changed files with 80 additions and 12 deletions

View File

@@ -1571,6 +1571,35 @@
(quote dom-remove-class)
(if (nil? raw-tgt) (quote me) (hs-to-sx raw-tgt))
(nth ast 1)))))
((= head (quote remove-class-when))
(let
((cls (nth ast 1))
(raw-tgt (nth ast 2))
(when-cond (nth ast 3)))
(let
((tgt-expr (cond
((and (list? raw-tgt) (= (first raw-tgt) (quote query)))
(list (quote hs-query-all) (nth raw-tgt 1)))
(true (hs-to-sx raw-tgt)))))
(list
(quote let)
(list
(list
(quote __hs-matched)
(list
(quote filter)
(list
(quote fn)
(list (quote it))
(hs-to-sx when-cond))
tgt-expr)))
(list
(quote for-each)
(list
(quote fn)
(list (quote it))
(list (quote dom-remove-class) (quote it) cls))
(quote __hs-matched))))))
((= head (quote remove-element))
(let
((tgt (nth ast 1)))