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-active" true)
|
||||
(dom-set-attr el "data-hyperscript-powered" "true")
|
||||
(let
|
||||
((handler (hs-handler src)))
|
||||
(guard
|
||||
(_e (true nil))
|
||||
(let
|
||||
((el-type (dom-get-attr el "type"))
|
||||
(comp-name (dom-get-attr el "component")))
|
||||
(if
|
||||
(= el-type "text/hyperscript-template")
|
||||
(for-each handler (hs-query-all (or comp-name "")))
|
||||
(handler el))))
|
||||
((handler (hs-handler src)))
|
||||
(let
|
||||
((el-type (dom-get-attr el "type"))
|
||||
(comp-name (dom-get-attr el "component")))
|
||||
(let
|
||||
((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)))))))
|
||||
|
||||
;; ── Boot subtree: for dynamic content ───────────────────────────
|
||||
|
||||
@@ -73,7 +73,12 @@
|
||||
((or (= typ "ident") (= typ "keyword"))
|
||||
(do
|
||||
(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 "class")
|
||||
(let
|
||||
@@ -1555,7 +1560,7 @@
|
||||
(fn
|
||||
()
|
||||
(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
|
||||
((tgt (if (= (tp-type) "attr") (let ((attr-name (get (adv!) "value"))) (list (quote attr) attr-name tgt-raw)) tgt-raw)))
|
||||
(cond
|
||||
|
||||
@@ -115,15 +115,21 @@
|
||||
(dom-set-data el "hs-script" src)
|
||||
(dom-set-data el "hs-active" true)
|
||||
(dom-set-attr el "data-hyperscript-powered" "true")
|
||||
(let
|
||||
((handler (hs-handler src)))
|
||||
(guard
|
||||
(_e (true nil))
|
||||
(let
|
||||
((el-type (dom-get-attr el "type"))
|
||||
(comp-name (dom-get-attr el "component")))
|
||||
(if
|
||||
(= el-type "text/hyperscript-template")
|
||||
(for-each handler (hs-query-all (or comp-name "")))
|
||||
(handler el))))
|
||||
((handler (hs-handler src)))
|
||||
(let
|
||||
((el-type (dom-get-attr el "type"))
|
||||
(comp-name (dom-get-attr el "component")))
|
||||
(let
|
||||
((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)))))))
|
||||
|
||||
;; ── Boot subtree: for dynamic content ───────────────────────────
|
||||
|
||||
@@ -73,7 +73,12 @@
|
||||
((or (= typ "ident") (= typ "keyword"))
|
||||
(do
|
||||
(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 "class")
|
||||
(let
|
||||
@@ -1555,7 +1560,7 @@
|
||||
(fn
|
||||
()
|
||||
(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
|
||||
((tgt (if (= (tp-type) "attr") (let ((attr-name (get (adv!) "value"))) (list (quote attr) attr-name tgt-raw)) tgt-raw)))
|
||||
(cond
|
||||
|
||||
Reference in New Issue
Block a user