mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
make-syntactic-closure generates a copy of existing closures, to allow for syntax generated syntax.
This commit is contained in:
parent
03b4ccc848
commit
a887b49e0c
1 changed files with 10 additions and 4 deletions
14
eval.c
14
eval.c
|
@ -360,12 +360,18 @@ static sexp sexp_make_macro (sexp ctx, sexp p, sexp e) {
|
||||||
|
|
||||||
sexp sexp_make_synclo_op (sexp ctx, sexp self, sexp_sint_t n, sexp env, sexp fv, sexp expr) {
|
sexp sexp_make_synclo_op (sexp ctx, sexp self, sexp_sint_t n, sexp env, sexp fv, sexp expr) {
|
||||||
sexp res;
|
sexp res;
|
||||||
if (! (sexp_symbolp(expr) || sexp_pairp(expr)))
|
if (! (sexp_symbolp(expr) || sexp_pairp(expr) || sexp_synclop(expr)))
|
||||||
return expr;
|
return expr;
|
||||||
res = sexp_alloc_type(ctx, synclo, SEXP_SYNCLO);
|
res = sexp_alloc_type(ctx, synclo, SEXP_SYNCLO);
|
||||||
sexp_synclo_env(res) = env;
|
if (sexp_synclop(expr)) {
|
||||||
sexp_synclo_free_vars(res) = fv;
|
sexp_synclo_env(res) = sexp_synclo_env(expr);
|
||||||
sexp_synclo_expr(res) = expr;
|
sexp_synclo_free_vars(res) = sexp_synclo_free_vars(expr);
|
||||||
|
sexp_synclo_expr(res) = sexp_synclo_expr(expr);
|
||||||
|
} else {
|
||||||
|
sexp_synclo_env(res) = env;
|
||||||
|
sexp_synclo_free_vars(res) = fv;
|
||||||
|
sexp_synclo_expr(res) = expr;
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue