fix linking of compiled reference to a top-level variable

Re-linking in a new namespace doesn't need the namespace of
compilation.

A "namespac.rktl" test exposed this problem, where the "transfer a
definition of a macro-introduced variable" test could fail if a GC
occurred between compilation in one namespace and evaluation in
another.
This commit is contained in:
Matthew Flatt 2015-07-31 11:17:25 -06:00
parent 1f2e0dacb3
commit 086d02003a

View File

@ -1004,9 +1004,9 @@ static Scheme_Object *link_toplevel(Scheme_Object **exprs, int which, Scheme_Env
home = scheme_get_bucket_home(b);
if (!env || !home)
if (!env)
return (Scheme_Object *)b;
else if (!home->module)
else if (!home || !home->module)
return (Scheme_Object *)scheme_global_bucket((Scheme_Object *)b->key, env);
else
return link_module_variable(home->module->modname,