HS: fix empty multi-element + meta reserved var in for loop
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s

This commit is contained in:
2026-04-26 22:46:51 +00:00
parent 68d81f59a6
commit 5ddd558eb7
2 changed files with 20 additions and 4 deletions

View File

@@ -413,11 +413,14 @@
(hs-to-sx mode)
(list (quote fn) (list) body)))))))
(define
hs-reserved-var?
(fn (name) (or (= name "meta") (= name "event") (= name "it") (= name "result")))
emit-for
(fn
(ast)
(let
((var-name (nth ast 1))
(safe-param (if (hs-reserved-var? var-name) (str "_hs_lv_" var-name) var-name))
(raw-coll-ast (nth ast 2))
(where-cond
(if
@@ -452,12 +455,12 @@
(quote map-indexed)
(list
(quote fn)
(list (make-symbol (nth ast 5)) (make-symbol var-name))
(list (make-symbol (nth ast 5)) (make-symbol safe-param))
body)
collection)
(list
(quote hs-for-each)
(list (quote fn) (list (make-symbol var-name)) body)
(list (quote fn) (list (make-symbol safe-param)) body)
collection)))))
(define
emit-wait-for
@@ -1556,6 +1559,11 @@
(emit-set
tgt
(list (quote hs-empty-like) (hs-to-sx tgt))))
((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))))
(true (list (quote hs-empty-target!) (hs-to-sx tgt))))))
((= head (quote open-element))
(list (quote hs-open!) (hs-to-sx (nth ast 1))))

View File

@@ -413,11 +413,14 @@
(hs-to-sx mode)
(list (quote fn) (list) body)))))))
(define
hs-reserved-var?
(fn (name) (or (= name "meta") (= name "event") (= name "it") (= name "result")))
emit-for
(fn
(ast)
(let
((var-name (nth ast 1))
(safe-param (if (hs-reserved-var? var-name) (str "_hs_lv_" var-name) var-name))
(raw-coll-ast (nth ast 2))
(where-cond
(if
@@ -452,12 +455,12 @@
(quote map-indexed)
(list
(quote fn)
(list (make-symbol (nth ast 5)) (make-symbol var-name))
(list (make-symbol (nth ast 5)) (make-symbol safe-param))
body)
collection)
(list
(quote hs-for-each)
(list (quote fn) (list (make-symbol var-name)) body)
(list (quote fn) (list (make-symbol safe-param)) body)
collection)))))
(define
emit-wait-for
@@ -1556,6 +1559,11 @@
(emit-set
tgt
(list (quote hs-empty-like) (hs-to-sx tgt))))
((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))))
(true (list (quote hs-empty-target!) (hs-to-sx tgt))))))
((= head (quote open-element))
(list (quote hs-open!) (hs-to-sx (nth ast 1))))