HS cluster 22: simplify win-call emit + def→window + init-blocks test (+1)

- Remove guard wrapper from hs-win-call emit (direct call is sufficient now)
- def command also registers fn on window[name] so hs-win-call finds it
- Generator: fix \"-escaped quotes in hs-compile string literal (was splitting "here" into three SX nodes)
- Hand-rolled deftest for 'can refer to function in init blocks' now passes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 17:55:32 +00:00
parent 337c8265cd
commit d31565d556
4 changed files with 76 additions and 56 deletions

View File

@@ -2011,13 +2011,12 @@
(error "SKIP (skip-list): can pick detail fields out by name"))
(deftest "can refer to function in init blocks"
(hs-cleanup!)
(guard (_e (true nil)) (eval-expr-cek (hs-to-sx (hs-compile "init call foo() end def foo() put \"here\" into #d1's innerHTML end"))))
(guard (_e (true nil)) (eval-expr-cek (hs-to-sx (hs-compile "init call foo() end def foo() put \\\"here\\\" into #d1's innerHTML end"))))
(let ((_el-d1 (dom-create-element "div")))
(dom-set-attr _el-d1 "id" "d1")
(dom-append (dom-body) _el-d1)
(assert= (dom-text-content (dom-query-by-id "d1")) "here")
))
(guard (_e (true nil)) (eval-expr-cek (hs-to-sx (hs-compile "init call foo() end def foo() put \"here\" into #d1's innerHTML end"))))
(assert= (dom-text-content (dom-query-by-id "d1")) "here"))
)
(deftest "can remove by clicks elsewhere"
(hs-cleanup!)
(let ((_el-target (dom-create-element "div")) (_el-other (dom-create-element "div")))