mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
the top-level of a macro expansion should preserve the call site source (issue #835)
This commit is contained in:
parent
05ee42804a
commit
35eed62160
1 changed files with 6 additions and 2 deletions
6
eval.c
6
eval.c
|
@ -776,8 +776,12 @@ static sexp analyze_macro_once (sexp ctx, sexp x, sexp op, int depth) {
|
||||||
res = sexp_exceptionp(tmp) ? tmp : sexp_make_child_context(ctx, sexp_context_lambda(ctx));
|
res = sexp_exceptionp(tmp) ? tmp : sexp_make_child_context(ctx, sexp_context_lambda(ctx));
|
||||||
if (!sexp_exceptionp(res) && !sexp_exceptionp(sexp_context_exception(ctx)))
|
if (!sexp_exceptionp(res) && !sexp_exceptionp(sexp_context_exception(ctx)))
|
||||||
res = sexp_apply(res, sexp_macro_proc(op), tmp);
|
res = sexp_apply(res, sexp_macro_proc(op), tmp);
|
||||||
if (sexp_exceptionp(res) && sexp_not(sexp_exception_source(x)))
|
if (sexp_pairp(sexp_car(tmp)) && sexp_pair_source(sexp_car(tmp))) {
|
||||||
|
if (sexp_pairp(res))
|
||||||
|
sexp_pair_source(res) = sexp_pair_source(sexp_car(tmp));
|
||||||
|
else if (sexp_exceptionp(res) && sexp_not(sexp_exception_source(x)))
|
||||||
sexp_exception_source(res) = sexp_pair_source(sexp_car(tmp));
|
sexp_exception_source(res) = sexp_pair_source(sexp_car(tmp));
|
||||||
|
}
|
||||||
sexp_gc_release1(ctx);
|
sexp_gc_release1(ctx);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue