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:
@@ -69,14 +69,20 @@
|
|||||||
(list (quote host-get) (hs-to-sx obj-ast) (nth base 1))
|
(list (quote host-get) (hs-to-sx obj-ast) (nth base 1))
|
||||||
prop-name
|
prop-name
|
||||||
value))
|
value))
|
||||||
;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value)
|
;; (attr "name") of obj → (dom-set-attr (compiled-obj) "name" value)
|
||||||
(if (and (list? prop-ast) (= (first prop-ast) (quote ref)))
|
(if (and (list? prop-ast) (= (first prop-ast) (quote attr)))
|
||||||
(list (quote dom-set-prop)
|
(list (quote dom-set-attr)
|
||||||
(hs-to-sx obj-ast)
|
(hs-to-sx obj-ast)
|
||||||
(nth prop-ast 1)
|
(nth prop-ast 1)
|
||||||
value)
|
value)
|
||||||
;; Fallback
|
;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value)
|
||||||
(list (quote set!) (hs-to-sx target) value)))))
|
(if (and (list? prop-ast) (= (first prop-ast) (quote ref)))
|
||||||
|
(list (quote dom-set-prop)
|
||||||
|
(hs-to-sx obj-ast)
|
||||||
|
(nth prop-ast 1)
|
||||||
|
value)
|
||||||
|
;; Fallback
|
||||||
|
(list (quote set!) (hs-to-sx target) value))))))
|
||||||
(true (list (quote set!) (hs-to-sx target) value)))))))
|
(true (list (quote set!) (hs-to-sx target) value)))))))
|
||||||
(define
|
(define
|
||||||
emit-on
|
emit-on
|
||||||
|
|||||||
@@ -69,14 +69,20 @@
|
|||||||
(list (quote host-get) (hs-to-sx obj-ast) (nth base 1))
|
(list (quote host-get) (hs-to-sx obj-ast) (nth base 1))
|
||||||
prop-name
|
prop-name
|
||||||
value))
|
value))
|
||||||
;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value)
|
;; (attr "name") of obj → (dom-set-attr (compiled-obj) "name" value)
|
||||||
(if (and (list? prop-ast) (= (first prop-ast) (quote ref)))
|
(if (and (list? prop-ast) (= (first prop-ast) (quote attr)))
|
||||||
(list (quote dom-set-prop)
|
(list (quote dom-set-attr)
|
||||||
(hs-to-sx obj-ast)
|
(hs-to-sx obj-ast)
|
||||||
(nth prop-ast 1)
|
(nth prop-ast 1)
|
||||||
value)
|
value)
|
||||||
;; Fallback
|
;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value)
|
||||||
(list (quote set!) (hs-to-sx target) value)))))
|
(if (and (list? prop-ast) (= (first prop-ast) (quote ref)))
|
||||||
|
(list (quote dom-set-prop)
|
||||||
|
(hs-to-sx obj-ast)
|
||||||
|
(nth prop-ast 1)
|
||||||
|
value)
|
||||||
|
;; Fallback
|
||||||
|
(list (quote set!) (hs-to-sx target) value))))))
|
||||||
(true (list (quote set!) (hs-to-sx target) value)))))))
|
(true (list (quote set!) (hs-to-sx target) value)))))))
|
||||||
(define
|
(define
|
||||||
emit-on
|
emit-on
|
||||||
|
|||||||
Reference in New Issue
Block a user