Fixing macro environment to be the evaluation, not binding

environment, in let-syntax.  The difference arises when the same
binding is inside and outside the let-syntax.  Patch from Zhang Meng.
This commit is contained in:
Alex Shinn 2013-01-03 22:34:40 +09:00
parent c0b257db25
commit df116bb779

2
eval.c
View file

@ -828,7 +828,7 @@ static sexp analyze_bind_syntax (sexp ls, sexp eval_ctx, sexp bind_ctx) {
else else
mac = sexp_eval(eval_ctx, sexp_cadar(ls), NULL); mac = sexp_eval(eval_ctx, sexp_cadar(ls), NULL);
if (sexp_procedurep(mac)) if (sexp_procedurep(mac))
mac = sexp_make_macro(eval_ctx, mac, sexp_context_env(bind_ctx)); mac = sexp_make_macro(eval_ctx, mac, sexp_context_env(eval_ctx));
if (!(sexp_macrop(mac)||sexp_corep(mac))) { if (!(sexp_macrop(mac)||sexp_corep(mac))) {
res = (sexp_exceptionp(mac) ? mac res = (sexp_exceptionp(mac) ? mac
: sexp_compile_error(eval_ctx, "non-procedure macro", mac)); : sexp_compile_error(eval_ctx, "non-procedure macro", mac));