AOT build: set per-ns ns context and register aliases
The source loader sets the current ns and registers :as aliases per file. The
build flattened every app namespace into one image with no such markers, so all
app forms ran under the last-set ns ("user"). Two breakages followed, both only
in a built binary:
- defmulti/defmethod resolve their target var through chez-current-ns, so they
registered the multifn under "user" while compiled var-derefs used the baked
ns — the multifn the app saw was uninitialized ("not a fn nil" on dispatch).
- a quoted alias-qualified symbol (a (defmethod ig/foo …) on an aliased multifn)
resolves its ns through chez-resolve-alias, but the stripped (ns …) form left
the alias table empty, so it landed in ns "ig".
bld-ns-prelude now emits (set-chez-ns! ns) plus chez-register-alias! for each
ns's :as aliases before that ns's forms, in both the normal and tree-shake emit
paths. The build-app fixture gains a :default multimethod and an aliased cross-ns
defmethod so buildsmoke covers both across all build modes.
This commit is contained in:
parent
ea609d72eb
commit
66ad475722
5 changed files with 79 additions and 4 deletions
|
|
@ -44,7 +44,9 @@ want='embedded resource ok
|
|||
HELLO FROM A BUILT BINARY!
|
||||
HELLO FROM A BUILT BINARY!
|
||||
args: [alpha bb ccc]
|
||||
sum: 10'
|
||||
sum: 10
|
||||
greet-default: greet:default
|
||||
greet-loud: greet:loud'
|
||||
if [ "$got" != "$want" ]; then
|
||||
echo " FAIL: binary output mismatch"
|
||||
echo "--- want ---"; echo "$want"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue