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:
@@ -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 ─────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user