HS compiler: emit-set handles @attr of target expressions

Adds attribute reference case to the 'of' branch in emit-set:
(set @bar of #div2 to "foo") now compiles to (dom-set-attr target "bar" "foo")
instead of falling through to the broken (set! (host-get ...)) catchall.

417/831 (50.2%), +2 from attr-of fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 19:47:30 +00:00
parent b1666a5fe2
commit e5e3e90ee7
2 changed files with 22 additions and 10 deletions

View File

@@ -69,6 +69,12 @@
(list (quote host-get) (hs-to-sx obj-ast) (nth base 1))
prop-name
value))
;; (attr "name") of obj → (dom-set-attr (compiled-obj) "name" value)
(if (and (list? prop-ast) (= (first prop-ast) (quote attr)))
(list (quote dom-set-attr)
(hs-to-sx obj-ast)
(nth prop-ast 1)
value)
;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value)
(if (and (list? prop-ast) (= (first prop-ast) (quote ref)))
(list (quote dom-set-prop)
@@ -76,7 +82,7 @@
(nth prop-ast 1)
value)
;; Fallback
(list (quote set!) (hs-to-sx target) value)))))
(list (quote set!) (hs-to-sx target) value))))))
(true (list (quote set!) (hs-to-sx target) value)))))))
(define
emit-on

View File

@@ -69,6 +69,12 @@
(list (quote host-get) (hs-to-sx obj-ast) (nth base 1))
prop-name
value))
;; (attr "name") of obj → (dom-set-attr (compiled-obj) "name" value)
(if (and (list? prop-ast) (= (first prop-ast) (quote attr)))
(list (quote dom-set-attr)
(hs-to-sx obj-ast)
(nth prop-ast 1)
value)
;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value)
(if (and (list? prop-ast) (= (first prop-ast) (quote ref)))
(list (quote dom-set-prop)
@@ -76,7 +82,7 @@
(nth prop-ast 1)
value)
;; Fallback
(list (quote set!) (hs-to-sx target) value)))))
(list (quote set!) (hs-to-sx target) value))))))
(true (list (quote set!) (hs-to-sx target) value)))))))
(define
emit-on