HS: js-block return values + worker stub test

Parser: parse-js-block extracts raw JS source by character positions.
Compiler: js-block AST → hs-js-exec call, stores result in it.
Runtime: hs-js-exec creates JS Function, handles promise rejection.
Test runner: host-new-function/host-promise-state natives + promise monkey-patch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 15:26:26 +00:00
parent 4b69650336
commit 8e8c2a73d6
9 changed files with 188 additions and 3 deletions

View File

@@ -2268,6 +2268,25 @@
(list (quote hs-halt!) (quote event) (nth ast 1)))
((= head (quote focus!))
(list (quote dom-focus) (hs-to-sx (nth ast 1))))
((= head (quote js-block))
(let
((params (nth ast 1)) (js-src (nth ast 2)))
(let
((bound-syms (map (fn (p) (make-symbol p)) params)))
(list
(quote let)
(list
(list
(quote __hs-js)
(list
(quote hs-js-exec)
(cons (quote list) params)
js-src
(cons (quote list) bound-syms))))
(list
(quote begin)
(list (quote set!) (quote it) (quote __hs-js))
(quote __hs-js))))))
(true ast)))))))))
;; ── Convenience: source → SX ─────────────────────────────────