Compiler: handle :effects annotation in define, adapter-sx.sx compiles
Fixed compile-define to skip :effects/:as keyword annotations between the name and body. (define name :effects [render] (fn ...)) now correctly compiles the fn body, not the :effects keyword. Result: adapter-sx.sx compiles to 25 code objects, 4044 bytes of bytecode. All 12 aser functions (aser, aser-call, aser-list, aser-fragment, aser-expand-component, etc.) compile successfully. 40/40 VM tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -429,7 +429,20 @@
|
||||
(name (if (= (type-of name-expr) "symbol")
|
||||
(symbol-name name-expr)
|
||||
name-expr))
|
||||
(value (nth args 1))
|
||||
;; Handle :effects annotation: (define name :effects [...] value)
|
||||
;; Skip keyword-value pairs between name and body
|
||||
(value (let ((rest-args (rest args)))
|
||||
(if (and (not (empty? rest-args))
|
||||
(= (type-of (first rest-args)) "keyword"))
|
||||
;; Skip :keyword value pairs until we hit the body
|
||||
(let ((skip-annotations
|
||||
(fn (items)
|
||||
(if (empty? items) nil
|
||||
(if (= (type-of (first items)) "keyword")
|
||||
(skip-annotations (rest (rest items)))
|
||||
(first items))))))
|
||||
(skip-annotations rest-args))
|
||||
(first rest-args))))
|
||||
(name-idx (pool-add (get em "pool") name)))
|
||||
(compile-expr em value scope false)
|
||||
(emit-op em 128) ;; OP_DEFINE
|
||||
|
||||
Reference in New Issue
Block a user