fix misplaced phase shift in submodule expansion

Merge to 5.3
This commit is contained in:
Matthew Flatt 2012-04-19 12:26:41 -06:00
parent fdb4ab7025
commit 8600e7fe31
2 changed files with 11 additions and 2 deletions

View File

@ -317,6 +317,14 @@
(module* test #f (module* test #f
(f))))) (f)))))
(expand
(expand
'(module m racket/base
(define (print-cake n) n)
(module* main2 #f
(module* inner-main #f
(print-cake 20))))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; `begin-for-syntax' doesn't affect `module' with non-#f language: ;; `begin-for-syntax' doesn't affect `module' with non-#f language:

View File

@ -6615,10 +6615,8 @@ static Scheme_Object *do_module(Scheme_Object *form, Scheme_Comp_Env *env,
fm = scheme_add_rename(fm, rn); fm = scheme_add_rename(fm, rn);
mb_ctx = scheme_add_rename(form, rn); mb_ctx = scheme_add_rename(form, rn);
} else { } else {
/* phase shift to replace self_modidx of previous expansion: */
if (!SCHEME_STXP(fm)) if (!SCHEME_STXP(fm))
fm = scheme_datum_to_syntax(fm, scheme_false, scheme_false, 0, 0); fm = scheme_datum_to_syntax(fm, scheme_false, scheme_false, 0, 0);
fm = scheme_stx_phase_shift(fm, NULL, empty_self_modidx, self_modidx, NULL, m->insp);
} }
/* there must be a `#%module-begin' in the enclosing module, right? */ /* there must be a `#%module-begin' in the enclosing module, right? */
saw_mb = 1; saw_mb = 1;
@ -6660,6 +6658,9 @@ static Scheme_Object *do_module(Scheme_Object *form, Scheme_Comp_Env *env,
fm = scheme_stx_phase_shift(fm, NULL, empty_self_modidx, self_modidx, NULL, m->insp); fm = scheme_stx_phase_shift(fm, NULL, empty_self_modidx, self_modidx, NULL, m->insp);
fm = scheme_add_rename(fm, rn_set); fm = scheme_add_rename(fm, rn_set);
} else if (skip_strip) {
/* phase shift to replace self_modidx of previous expansion: */
fm = scheme_stx_phase_shift(fm, NULL, empty_self_modidx, self_modidx, NULL, m->insp);
} }
SCHEME_EXPAND_OBSERVE_RENAME_ONE(rec[drec].observer, fm); SCHEME_EXPAND_OBSERVE_RENAME_ONE(rec[drec].observer, fm);