HS: fix log multi-arg parsing + put! position aliases + sender lookup
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 40s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 40s
- parse-log-cmd now collects comma-separated args: log a, b, c previously only consumed the first arg, causing the rest to be standalone statement-commands that failed to parse - compiler log case emits (do (console-log a) (console-log b) ...) since console-log is single-arg - hs-put! accepts before/after/start/end as aliases for the beforebegin/afterend/afterbegin/beforeend positions - hs-sender uses (get detail "sender") — direct SX dict lookup instead of host-get round-trip through JS Fixes "can reference sender in events" test: 8/8 hs-upstream-send Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2017,7 +2017,11 @@
|
||||
((= head (quote wait)) (list (quote hs-wait) (nth ast 1)))
|
||||
((= head (quote wait-for)) (emit-wait-for ast))
|
||||
((= head (quote log))
|
||||
(list (quote console-log) (hs-to-sx (nth ast 1))))
|
||||
(cons
|
||||
(quote do)
|
||||
(map
|
||||
(fn (arg) (list (quote console-log) (hs-to-sx arg)))
|
||||
(rest ast))))
|
||||
((= head (quote send)) (emit-send ast))
|
||||
((= head (quote trigger))
|
||||
(let
|
||||
|
||||
@@ -1748,7 +1748,21 @@
|
||||
dtl
|
||||
(list (quote trigger) name dtl tgt)
|
||||
(list (quote trigger) name tgt)))))))
|
||||
(define parse-log-cmd (fn () (list (quote log) (parse-expr))))
|
||||
(define
|
||||
parse-log-cmd
|
||||
(fn
|
||||
()
|
||||
(define
|
||||
collect-args
|
||||
(fn
|
||||
(acc)
|
||||
(if
|
||||
(= (tp-type) "comma")
|
||||
(do
|
||||
(adv!)
|
||||
(collect-args (append acc (list (parse-expr)))))
|
||||
acc)))
|
||||
(cons (quote log) (collect-args (list (parse-expr))))))
|
||||
(define
|
||||
parse-inc-cmd
|
||||
(fn
|
||||
|
||||
@@ -411,7 +411,7 @@
|
||||
(do
|
||||
(dom-set-inner-html target value)
|
||||
(hs-boot-subtree! target)))))
|
||||
((= pos "beforebegin")
|
||||
((or (= pos "beforebegin") (= pos "before"))
|
||||
(if
|
||||
(hs-element? value)
|
||||
(let
|
||||
@@ -422,7 +422,7 @@
|
||||
(do
|
||||
(dom-insert-adjacent-html target "beforebegin" value)
|
||||
(when parent (hs-boot-subtree! parent))))))
|
||||
((= pos "afterend")
|
||||
((or (= pos "afterend") (= pos "after"))
|
||||
(if
|
||||
(hs-element? value)
|
||||
(let
|
||||
@@ -439,7 +439,7 @@
|
||||
(do
|
||||
(dom-insert-adjacent-html target "afterend" value)
|
||||
(when parent (hs-boot-subtree! parent))))))
|
||||
((= pos "afterbegin")
|
||||
((or (= pos "afterbegin") (= pos "start"))
|
||||
(cond
|
||||
((list? value) (append! target value 0))
|
||||
((hs-element? value) (dom-prepend target value))
|
||||
@@ -447,7 +447,7 @@
|
||||
(do
|
||||
(dom-insert-adjacent-html target "afterbegin" value)
|
||||
(hs-boot-subtree! target)))))
|
||||
((= pos "beforeend")
|
||||
((or (= pos "beforeend") (= pos "end"))
|
||||
(cond
|
||||
((list? value) (append! target value))
|
||||
((hs-element? value) (dom-append target value))
|
||||
@@ -998,7 +998,7 @@
|
||||
(event)
|
||||
(let
|
||||
((detail (host-get event "detail")))
|
||||
(if detail (host-get detail "sender") nil))))
|
||||
(if detail (get detail "sender") nil))))
|
||||
|
||||
(define
|
||||
hs-host-to-sx
|
||||
|
||||
Reference in New Issue
Block a user