fix phase-related export bug

which was previously masked by another bug
This commit is contained in:
Matthew Flatt 2011-11-18 22:59:21 -07:00
parent c1477e945d
commit 76c9996ac7

View File

@ -8252,10 +8252,18 @@ static Scheme_Object *extract_free_id_name(Scheme_Object *name,
/* genv is used for tl_id_sym */ /* genv is used for tl_id_sym */
} else { } else {
int i; int i;
for (i = SCHEME_INT_VAL(phase); i--; ) { i = SCHEME_INT_VAL(phase);
if (i > 0) {
for (; i--; ) {
genv = genv->exp_env; genv = genv->exp_env;
if (!genv) break; if (!genv) break;
} }
} else if (i < 0) {
for (; i++; ) {
genv = genv->template_env;
if (!genv) break;
}
}
} }
} }
@ -9269,6 +9277,7 @@ void add_single_require(Scheme_Module_Exports *me, /* from module */
Scheme_Object *nominal_modidx, *one_exn, *prnt_iname, *name, *rn, *ename = orig_ename; Scheme_Object *nominal_modidx, *one_exn, *prnt_iname, *name, *rn, *ename = orig_ename;
Scheme_Hash_Table *orig_onlys; Scheme_Hash_Table *orig_onlys;
int k, skip_rename, do_copy_vars; int k, skip_rename, do_copy_vars;
Scheme_Env *name_env;
if (mark_src) { if (mark_src) {
/* Check whether there's context for this import (which /* Check whether there's context for this import (which
@ -9313,13 +9322,28 @@ void add_single_require(Scheme_Module_Exports *me, /* from module */
pt = NULL; pt = NULL;
} }
name_env = orig_env;
if (pt) { if (pt) {
if (SCHEME_FALSEP(pt->phase_index)) if (SCHEME_FALSEP(pt->phase_index))
to_phase = scheme_false; to_phase = scheme_false;
else if (SCHEME_FALSEP(src_phase_index)) else if (SCHEME_FALSEP(src_phase_index))
to_phase = scheme_false; to_phase = scheme_false;
else else {
if (orig_env) {
to_phase = pt->phase_index;
while (SCHEME_INT_VAL(to_phase) > 0) {
scheme_prepare_exp_env(name_env);
name_env = name_env->exp_env;
to_phase = scheme_bin_minus(to_phase, scheme_make_integer(1));
}
while (SCHEME_INT_VAL(to_phase) < 0) {
scheme_prepare_template_env(name_env);
name_env = name_env->template_env;
to_phase = scheme_bin_plus(to_phase, scheme_make_integer(1));
}
}
to_phase = scheme_bin_plus(pt->phase_index, src_phase_index); to_phase = scheme_bin_plus(pt->phase_index, src_phase_index);
}
} else } else
to_phase = NULL; to_phase = NULL;
@ -9422,7 +9446,7 @@ void add_single_require(Scheme_Module_Exports *me, /* from module */
/* The `require' expression has a set of marks in its /* The `require' expression has a set of marks in its
context, which means that we need to generate a name. */ context, which means that we need to generate a name. */
iname = scheme_datum_to_syntax(iname, scheme_false, mark_src, 0, 0); iname = scheme_datum_to_syntax(iname, scheme_false, mark_src, 0, 0);
iname = scheme_tl_id_sym(orig_env, iname, scheme_false, skip_rename ? 3 : 2, to_phase, NULL); iname = scheme_tl_id_sym(name_env, iname, scheme_false, skip_rename ? 3 : 2, to_phase, NULL);
if (all_simple) if (all_simple)
*all_simple = 0; *all_simple = 0;
} }