Cross-ns def/require/use/defmethod through the spine (jolt-c2l1)
The per-form eval passed a FIXED compile-ns to every subform of a top-level do,
so a runtime (ns ...)/(in-ns ...) didn't redirect later defs/refs — defs landed
in the wrong ns and qualified refs hit host-static ("Unknown class"). Thread
the current ns: each subform analyzes in (chez-current-ns), which ns/in-ns move.
That exposed two more gaps, now fixed:
- use refers ALL of a target's public vars (a refer-all table consulted by
chez-resolve-refer) — was bound to plain require (explicit :refer only).
- defmethod on a QUALIFIED multifn (cf.mm/ext from another ns) resolves in the
symbol's ns, not the current one (was auto-creating a stray multifn).
Corpus 2684->2688, 0 new divergences; floor raised. No re-mint (runtime shims).
This commit is contained in:
parent
76f8274603
commit
c788e86f1a
6 changed files with 50 additions and 8 deletions
|
|
@ -108,11 +108,15 @@
|
|||
;; visible (macro flag set, var interned) before a later subform is analyzed.
|
||||
(define (jolt-compile-eval-form form ns)
|
||||
(cond
|
||||
;; thread the current ns: an earlier subform may switch it (ns/in-ns call
|
||||
;; set-chez-ns!), and the next subform must be ANALYZED in that ns so its defs
|
||||
;; land there and its refs resolve (cross-ns def/require in one program).
|
||||
((ce-top-do? form)
|
||||
(let loop ((fs (cdr (seq->list form))) (result jolt-nil))
|
||||
(let loop ((fs (cdr (seq->list form))) (result jolt-nil) (cur ns))
|
||||
(if (null? fs)
|
||||
result
|
||||
(loop (cdr fs) (jolt-compile-eval-form (car fs) ns)))))
|
||||
(let ((r (jolt-compile-eval-form (car fs) cur)))
|
||||
(loop (cdr fs) r (chez-current-ns))))))
|
||||
;; runtime defmacro: def the expander fn + mark the var a macro so subsequent
|
||||
;; forms expand it (hc-macro? reads var-macro-table). Mirrors emit-image.ss
|
||||
;; ei-emit-ns.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue