HS: behavior cluster — install + element's subscript fix (+2 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
- install BehaviorName: parse-set-cmd handles `element` separately so `element's foo` after `set` invokes parse-poss rather than parse-expr, fixing `set element's bar["count"] to X` inside behavior bodies - parse-poss-tail ident case: call parse-poss (handles `[`) instead of parse-prop-chain (does not) when next token is bracket-open - hs-activate!: replace (handler el) with host-call-fn safe wrapper so native OCaml "Undefined symbol" throws (which bypass SX guard frames) are caught at the JS api_call_fn boundary rather than propagating Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -115,15 +115,21 @@
|
|||||||
(dom-set-data el "hs-script" src)
|
(dom-set-data el "hs-script" src)
|
||||||
(dom-set-data el "hs-active" true)
|
(dom-set-data el "hs-active" true)
|
||||||
(dom-set-attr el "data-hyperscript-powered" "true")
|
(dom-set-attr el "data-hyperscript-powered" "true")
|
||||||
(let
|
(guard
|
||||||
((handler (hs-handler src)))
|
(_e (true nil))
|
||||||
(let
|
(let
|
||||||
((el-type (dom-get-attr el "type"))
|
((handler (hs-handler src)))
|
||||||
(comp-name (dom-get-attr el "component")))
|
(let
|
||||||
(if
|
((el-type (dom-get-attr el "type"))
|
||||||
(= el-type "text/hyperscript-template")
|
(comp-name (dom-get-attr el "component")))
|
||||||
(for-each handler (hs-query-all (or comp-name "")))
|
(let
|
||||||
(handler el))))
|
((safe-handler (fn (e) (host-call-fn handler (list e)))))
|
||||||
|
(if
|
||||||
|
(= el-type "text/hyperscript-template")
|
||||||
|
(for-each
|
||||||
|
safe-handler
|
||||||
|
(hs-query-all (or comp-name "")))
|
||||||
|
(safe-handler el))))))
|
||||||
(dom-dispatch el "hyperscript:after:init" nil)))))))
|
(dom-dispatch el "hyperscript:after:init" nil)))))))
|
||||||
|
|
||||||
;; ── Boot subtree: for dynamic content ───────────────────────────
|
;; ── Boot subtree: for dynamic content ───────────────────────────
|
||||||
|
|||||||
@@ -73,7 +73,12 @@
|
|||||||
((or (= typ "ident") (= typ "keyword"))
|
((or (= typ "ident") (= typ "keyword"))
|
||||||
(do
|
(do
|
||||||
(adv!)
|
(adv!)
|
||||||
(parse-prop-chain (list (quote poss) owner val))))
|
(let
|
||||||
|
((base (list (quote poss) owner val)))
|
||||||
|
(if
|
||||||
|
(= (tp-type) "bracket-open")
|
||||||
|
(parse-poss base)
|
||||||
|
(parse-prop-chain base)))))
|
||||||
((= typ "attr") (do (adv!) (list (quote attr) val owner)))
|
((= typ "attr") (do (adv!) (list (quote attr) val owner)))
|
||||||
((= typ "class")
|
((= typ "class")
|
||||||
(let
|
(let
|
||||||
@@ -1555,7 +1560,7 @@
|
|||||||
(fn
|
(fn
|
||||||
()
|
()
|
||||||
(let
|
(let
|
||||||
((tgt-raw (cond ((and (= (tp-type) "ident") (or (= (tp-val) "element") (= (tp-val) "global") (= (tp-val) "local"))) (do (adv!) (parse-expr))) (true (parse-expr)))))
|
((tgt-raw (cond ((and (= (tp-type) "ident") (or (= (tp-val) "global") (= (tp-val) "local"))) (do (adv!) (parse-expr))) ((and (= (tp-type) "ident") (= (tp-val) "element")) (do (adv!) (if (and (= (tp-type) "op") (= (tp-val) "'s")) (parse-poss (list (quote ref) "element")) (parse-expr)))) (true (parse-expr)))))
|
||||||
(let
|
(let
|
||||||
((tgt (if (= (tp-type) "attr") (let ((attr-name (get (adv!) "value"))) (list (quote attr) attr-name tgt-raw)) tgt-raw)))
|
((tgt (if (= (tp-type) "attr") (let ((attr-name (get (adv!) "value"))) (list (quote attr) attr-name tgt-raw)) tgt-raw)))
|
||||||
(cond
|
(cond
|
||||||
|
|||||||
@@ -115,15 +115,21 @@
|
|||||||
(dom-set-data el "hs-script" src)
|
(dom-set-data el "hs-script" src)
|
||||||
(dom-set-data el "hs-active" true)
|
(dom-set-data el "hs-active" true)
|
||||||
(dom-set-attr el "data-hyperscript-powered" "true")
|
(dom-set-attr el "data-hyperscript-powered" "true")
|
||||||
(let
|
(guard
|
||||||
((handler (hs-handler src)))
|
(_e (true nil))
|
||||||
(let
|
(let
|
||||||
((el-type (dom-get-attr el "type"))
|
((handler (hs-handler src)))
|
||||||
(comp-name (dom-get-attr el "component")))
|
(let
|
||||||
(if
|
((el-type (dom-get-attr el "type"))
|
||||||
(= el-type "text/hyperscript-template")
|
(comp-name (dom-get-attr el "component")))
|
||||||
(for-each handler (hs-query-all (or comp-name "")))
|
(let
|
||||||
(handler el))))
|
((safe-handler (fn (e) (host-call-fn handler (list e)))))
|
||||||
|
(if
|
||||||
|
(= el-type "text/hyperscript-template")
|
||||||
|
(for-each
|
||||||
|
safe-handler
|
||||||
|
(hs-query-all (or comp-name "")))
|
||||||
|
(safe-handler el))))))
|
||||||
(dom-dispatch el "hyperscript:after:init" nil)))))))
|
(dom-dispatch el "hyperscript:after:init" nil)))))))
|
||||||
|
|
||||||
;; ── Boot subtree: for dynamic content ───────────────────────────
|
;; ── Boot subtree: for dynamic content ───────────────────────────
|
||||||
|
|||||||
@@ -73,7 +73,12 @@
|
|||||||
((or (= typ "ident") (= typ "keyword"))
|
((or (= typ "ident") (= typ "keyword"))
|
||||||
(do
|
(do
|
||||||
(adv!)
|
(adv!)
|
||||||
(parse-prop-chain (list (quote poss) owner val))))
|
(let
|
||||||
|
((base (list (quote poss) owner val)))
|
||||||
|
(if
|
||||||
|
(= (tp-type) "bracket-open")
|
||||||
|
(parse-poss base)
|
||||||
|
(parse-prop-chain base)))))
|
||||||
((= typ "attr") (do (adv!) (list (quote attr) val owner)))
|
((= typ "attr") (do (adv!) (list (quote attr) val owner)))
|
||||||
((= typ "class")
|
((= typ "class")
|
||||||
(let
|
(let
|
||||||
@@ -1555,7 +1560,7 @@
|
|||||||
(fn
|
(fn
|
||||||
()
|
()
|
||||||
(let
|
(let
|
||||||
((tgt-raw (cond ((and (= (tp-type) "ident") (or (= (tp-val) "element") (= (tp-val) "global") (= (tp-val) "local"))) (do (adv!) (parse-expr))) (true (parse-expr)))))
|
((tgt-raw (cond ((and (= (tp-type) "ident") (or (= (tp-val) "global") (= (tp-val) "local"))) (do (adv!) (parse-expr))) ((and (= (tp-type) "ident") (= (tp-val) "element")) (do (adv!) (if (and (= (tp-type) "op") (= (tp-val) "'s")) (parse-poss (list (quote ref) "element")) (parse-expr)))) (true (parse-expr)))))
|
||||||
(let
|
(let
|
||||||
((tgt (if (= (tp-type) "attr") (let ((attr-name (get (adv!) "value"))) (list (quote attr) attr-name tgt-raw)) tgt-raw)))
|
((tgt (if (= (tp-type) "attr") (let ((attr-name (get (adv!) "value"))) (list (quote attr) attr-name tgt-raw)) tgt-raw)))
|
||||||
(cond
|
(cond
|
||||||
|
|||||||
Reference in New Issue
Block a user