fix two macro-expansion bugs, one related to the top level, and one related to internal-definition positions
svn: r11900
This commit is contained in:
parent
772760f197
commit
cad726031f
|
@ -2513,11 +2513,20 @@ scheme_lookup_binding(Scheme_Object *find_id, Scheme_Comp_Env *env, int flags,
|
|||
|
||||
/* Used out of context? */
|
||||
if (SAME_OBJ(modidx, scheme_undefined)) {
|
||||
if (!env->genv->module && SCHEME_STXP(find_id)) {
|
||||
/* Looks like lexically bound, but double-check that it's not bound via a tl_id: */
|
||||
find_global_id = scheme_tl_id_sym(env->genv, find_id, NULL, 0, NULL);
|
||||
if (!SAME_OBJ(find_global_id, SCHEME_STX_VAL(find_id)))
|
||||
modidx = NULL; /* yes, it is bound */
|
||||
}
|
||||
|
||||
if (modidx) {
|
||||
if (!(flags & SCHEME_OUT_OF_CONTEXT_OK))
|
||||
scheme_wrong_syntax(scheme_compile_stx_string, NULL, find_id,
|
||||
"identifier used out of context");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (modidx) {
|
||||
/* If it's an access path, resolve it: */
|
||||
|
|
|
@ -6399,6 +6399,9 @@ scheme_compile_expand_block(Scheme_Object *forms, Scheme_Comp_Env *env,
|
|||
result = scheme_make_pair(result, scheme_null);
|
||||
SCHEME_EXPAND_OBSERVE_BLOCK_TO_LETREC(rec[drec].observer, result);
|
||||
return scheme_expand_list(result, env, rec, drec);
|
||||
} else {
|
||||
result = scheme_make_pair(result, scheme_null);
|
||||
return scheme_datum_to_syntax(result, forms, forms, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6420,6 +6423,7 @@ scheme_compile_expand_block(Scheme_Object *forms, Scheme_Comp_Env *env,
|
|||
rest = scheme_datum_to_syntax(rest, forms, forms, 0, 0);
|
||||
|
||||
first = scheme_compile_expr(first, env, recs, 0);
|
||||
|
||||
#if EMBEDDED_DEFINES_START_ANYWHERE
|
||||
forms = scheme_compile_expand_block(rest, env, recs, 1);
|
||||
#else
|
||||
|
|
|
@ -4464,6 +4464,9 @@ Scheme_Object *scheme_compile_sequence(Scheme_Object *forms,
|
|||
Scheme_Comp_Env *env,
|
||||
Scheme_Compile_Info *rec, int drec)
|
||||
{
|
||||
#if 0
|
||||
/* This attempt at a shortcut is wrong, because the sole expression might expand
|
||||
to a `begin' that needs to be spliced into an internal-definition context. */
|
||||
try_again:
|
||||
|
||||
if (SCHEME_STX_PAIRP(forms) && SCHEME_STX_NULLP(SCHEME_STX_CDR(forms))) {
|
||||
|
@ -4471,7 +4474,7 @@ Scheme_Object *scheme_compile_sequence(Scheme_Object *forms,
|
|||
Scheme_Object *first, *val;
|
||||
|
||||
first = SCHEME_STX_CAR(forms);
|
||||
first = scheme_check_immediate_macro(first, env, rec, drec, 0, &val, NULL, NULL);
|
||||
first = scheme_check_immediate_macro(first, env, rec, drec, 1, &val, NULL, NULL);
|
||||
|
||||
if (SAME_OBJ(val, scheme_begin_syntax) && SCHEME_STX_PAIRP(first)) {
|
||||
/* Flatten begin: */
|
||||
|
@ -4485,7 +4488,9 @@ Scheme_Object *scheme_compile_sequence(Scheme_Object *forms,
|
|||
}
|
||||
|
||||
return scheme_compile_expr(first, env, rec, drec);
|
||||
} else {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (scheme_stx_proper_list_length(forms) < 0) {
|
||||
scheme_wrong_syntax(scheme_begin_stx_string, NULL,
|
||||
scheme_datum_to_syntax(cons(begin_symbol, forms), forms, forms, 0, 0),
|
||||
|
@ -4497,7 +4502,6 @@ Scheme_Object *scheme_compile_sequence(Scheme_Object *forms,
|
|||
return scheme_make_sequence_compilation(body, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Scheme_Object *scheme_compiled_void()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user