fix submodule `expand' handling

Trying again for 4a0adb6a74.
This commit is contained in:
Matthew Flatt 2013-02-13 10:10:36 -07:00
parent 7dff18c385
commit d408ba43a8
5 changed files with 23 additions and 21 deletions

View File

@ -2522,6 +2522,8 @@ static Scheme_Object *local_submodules(int argc, Scheme_Object *argv[])
not_currently_transforming("syntax-local-submodules");
if (env->genv->module) {
l = env->genv->module->pre_submodule_names;
if (!l)
l = env->genv->module->pre_submodules;
if (l) {
while (!SCHEME_NULLP(l)) {

View File

@ -6219,10 +6219,8 @@ static void execute_submodules(Scheme_Module *m, int pre, Scheme_Env *genv,
}
while (!SCHEME_NULLP(p)) {
if (!SCHEME_SYMBOLP(SCHEME_CAR(p))) {
do_module_execute_recur(SCHEME_CAR(p), genv, set_cache, set_in_pre, prefix,
(Scheme_Object *)m);
}
p = SCHEME_CDR(p);
}
}
@ -6510,12 +6508,10 @@ static Scheme_Object *do_module_clone(Scheme_Object *data, int jit)
if (l1 && !SCHEME_NULLP(l1)) {
l2 = scheme_null;
while (!SCHEME_NULLP(l1)) {
if (!SCHEME_SYMBOLP(SCHEME_CAR(l1))) {
sm = do_module_clone(SCHEME_CAR(l1), jit);
if (!SAME_OBJ(sm, SCHEME_CAR(l1)))
submod_changed = 1;
l2 = scheme_make_pair(sm, l2);
}
l1 = SCHEME_CDR(l1);
}
if (submod_changed) {
@ -9260,11 +9256,10 @@ static Scheme_Object *expand_submodules(Scheme_Compile_Expand_Info *rec, int dre
env->genv->module->pre_submodules = l;
}
} else if (!SCHEME_NULLP(mods)) {
if (post) {
/* setting pre_submodules to '() indicates that there were submodules during expansion */
env->genv->module->pre_submodules = scheme_null;
} else {
l = env->genv->module->pre_submodules;
if (!post) {
l = env->genv->module->pre_submodule_names;
if (!l) l = scheme_null;
/* extract just the name: */
mod = SCHEME_CAR(mods);
@ -9272,7 +9267,7 @@ static Scheme_Object *expand_submodules(Scheme_Compile_Expand_Info *rec, int dre
mod = SCHEME_STX_CAR(mod);
mod = SCHEME_STX_VAL(mod);
l = scheme_make_pair(mod, l);
env->genv->module->pre_submodules = l;
env->genv->module->pre_submodule_names = l;
}
}
@ -10963,6 +10958,8 @@ static int check_is_submodule(Scheme_Object *modname, Scheme_Object *_genv)
Scheme_Object *l, *n;
if (genv->module) {
l = genv->module->pre_submodule_names;
if (!l)
l = genv->module->pre_submodules;
if (l) {
while (!SCHEME_NULLP(l)) {

View File

@ -2654,6 +2654,7 @@ static int module_val_MARK(void *p, struct NewGC *gc) {
gcMARK2(m->submodule_path, gc);
gcMARK2(m->pre_submodules, gc);
gcMARK2(m->post_submodules, gc);
gcMARK2(m->pre_submodule_names, gc);
gcMARK2(m->supermodule, gc);
gcMARK2(m->submodule_ancestry, gc);
@ -2701,6 +2702,7 @@ static int module_val_FIXUP(void *p, struct NewGC *gc) {
gcFIXUP2(m->submodule_path, gc);
gcFIXUP2(m->pre_submodules, gc);
gcFIXUP2(m->post_submodules, gc);
gcFIXUP2(m->pre_submodule_names, gc);
gcFIXUP2(m->supermodule, gc);
gcFIXUP2(m->submodule_ancestry, gc);

View File

@ -1081,6 +1081,7 @@ module_val {
gcMARK2(m->submodule_path, gc);
gcMARK2(m->pre_submodules, gc);
gcMARK2(m->post_submodules, gc);
gcMARK2(m->pre_submodule_names, gc);
gcMARK2(m->supermodule, gc);
gcMARK2(m->submodule_ancestry, gc);

View File

@ -3294,8 +3294,8 @@ typedef struct Scheme_Module
Scheme_Object *rn_stx; /* NULL, #t, a stx for a rename, a vector of stxes, or a pair to delay shifts */
Scheme_Object *submodule_path; /* path to this module relative to enclosing top-level module */
Scheme_Object *pre_submodules; /* list of modules (when compiled or loaded as a group) or symbols (during expand) */
Scheme_Object *post_submodules; /* list of modules (when compiled or loaded as a group) */
Scheme_Object *pre_submodules, *post_submodules; /* list of modules (when compiled or loaded as a group) */
Scheme_Object *pre_submodule_names; /* list of symbols (in expand mode) */
Scheme_Object *supermodule; /* supermodule for which this is in {pre,post}_submodules */
Scheme_Object *submodule_ancestry; /* se by compile/expand, temporary */
} Scheme_Module;