HS: empty multi-element fix (+1 test)

empty .class compiled (empty-target (query ".class")) to
(hs-empty-target! (hs-query-first ".class")) via hs-to-sx — only
emptying the first match. Fix: detect (query ...) target in the
empty-target compiler case and emit (for-each (fn (_el)
(hs-empty-target! _el)) (hs-query-all sel)) instead, mirroring the
add-class pattern. Suite hs-upstream-empty: 12/13 → 13/13.
Smoke 0-195: 175/195 unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 15:02:47 +00:00
parent f715d23e10
commit 875e9ba317
2 changed files with 22 additions and 2 deletions

View File

@@ -1547,7 +1547,17 @@
(emit-set
tgt
(list (quote hs-empty-like) (hs-to-sx tgt))))
(true (list (quote hs-empty-target!) (hs-to-sx tgt))))))
(true
(if
(and (list? tgt) (= (first tgt) (quote query)))
(list
(quote for-each)
(list
(quote fn)
(list (quote _el))
(list (quote hs-empty-target!) (quote _el)))
(list (quote hs-query-all) (nth tgt 1)))
(list (quote hs-empty-target!) (hs-to-sx tgt)))))))
((= head (quote open-element))
(list (quote hs-open!) (hs-to-sx (nth ast 1))))
((= head (quote close-element))

View File

@@ -1547,7 +1547,17 @@
(emit-set
tgt
(list (quote hs-empty-like) (hs-to-sx tgt))))
(true (list (quote hs-empty-target!) (hs-to-sx tgt))))))
(true
(if
(and (list? tgt) (= (first tgt) (quote query)))
(list
(quote for-each)
(list
(quote fn)
(list (quote _el))
(list (quote hs-empty-target!) (quote _el)))
(list (quote hs-query-all) (nth tgt 1)))
(list (quote hs-empty-target!) (hs-to-sx tgt)))))))
((= head (quote open-element))
(list (quote hs-open!) (hs-to-sx (nth ast 1))))
((= head (quote close-element))