Fix Pretext island: library functions inside define-library begin block
Root cause: sx_insert_near placed break-lines-greedy, pretext-position-line, pretext-layout-lines OUTSIDE the define-library begin block. The bytecode compiler only compiles forms inside begin as STORE_GLOBAL — forms outside are invisible to the browser VM. Fix: moved all function definitions inside (begin ...) of (define-library). Bytecode now includes all 17 functions (11K compiled, was 9K). Browser load-sxbc: simplified VmSuspended handling — just catch and continue, since STORE_GLOBAL ops already ran before the import OP_PERFORM. sync_vm_to_env copies them to global_env. Island now calls break-lines and pretext-layout-lines from bytecode-compiled library — runs on VM, not CEK interpreter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -240,18 +240,22 @@
|
||||
((prop (nth ast 1)) (value (hs-to-sx (nth ast 2))))
|
||||
(if
|
||||
(= (len ast) 5)
|
||||
(list
|
||||
(quote hs-transition)
|
||||
(hs-to-sx (nth ast 4))
|
||||
prop
|
||||
value
|
||||
(nth ast 3))
|
||||
(list
|
||||
(quote hs-transition)
|
||||
(hs-to-sx (nth ast 3))
|
||||
prop
|
||||
value
|
||||
nil)))))
|
||||
(let
|
||||
((raw-tgt (nth ast 4)))
|
||||
(list
|
||||
(quote hs-transition)
|
||||
(if (nil? raw-tgt) (quote me) (hs-to-sx raw-tgt))
|
||||
prop
|
||||
value
|
||||
(nth ast 3)))
|
||||
(let
|
||||
((raw-tgt (nth ast 3)))
|
||||
(list
|
||||
(quote hs-transition)
|
||||
(if (nil? raw-tgt) (quote me) (hs-to-sx raw-tgt))
|
||||
prop
|
||||
value
|
||||
nil))))))
|
||||
(define
|
||||
emit-make
|
||||
(fn
|
||||
@@ -913,6 +917,19 @@
|
||||
(list (quote dom-set-style) tgt "visibility" "visible"))
|
||||
(true (list (quote dom-set-style) tgt "display" "")))))
|
||||
((= head (quote transition)) (emit-transition ast))
|
||||
((= head (quote transition-from))
|
||||
(let
|
||||
((prop (nth ast 1))
|
||||
(from-val (hs-to-sx (nth ast 2)))
|
||||
(to-val (hs-to-sx (nth ast 3)))
|
||||
(dur (nth ast 4)))
|
||||
(list
|
||||
(quote hs-transition-from)
|
||||
(quote me)
|
||||
prop
|
||||
from-val
|
||||
to-val
|
||||
dur)))
|
||||
((= head (quote repeat)) (emit-repeat ast))
|
||||
((= head (quote fetch))
|
||||
(list (quote hs-fetch) (hs-to-sx (nth ast 1)) (nth ast 2)))
|
||||
|
||||
Reference in New Issue
Block a user