mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Iteratively expand variable-transformer set!
This commit is contained in:
parent
83f61aecd2
commit
f63348a4d1
1 changed files with 7 additions and 4 deletions
11
eval.c
11
eval.c
|
@ -811,7 +811,7 @@ static sexp analyze_var_ref (sexp ctx, sexp x, sexp *varenv) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static sexp analyze_set (sexp ctx, sexp x, int depth, int defok) {
|
static sexp analyze_set (sexp ctx, sexp x, int depth) {
|
||||||
sexp res, varenv;
|
sexp res, varenv;
|
||||||
sexp_gc_var4(ref, value, cell, op);
|
sexp_gc_var4(ref, value, cell, op);
|
||||||
sexp_gc_preserve4(ctx, ref, value, cell, op);
|
sexp_gc_preserve4(ctx, ref, value, cell, op);
|
||||||
|
@ -826,8 +826,6 @@ static sexp analyze_set (sexp ctx, sexp x, int depth, int defok) {
|
||||||
res = sexp_compile_error(ctx, "can't mutate a syntax keyword", sexp_cadr(x));
|
res = sexp_compile_error(ctx, "can't mutate a syntax keyword", sexp_cadr(x));
|
||||||
} else {
|
} else {
|
||||||
res = analyze_macro_once(ctx, x, op, depth);
|
res = analyze_macro_once(ctx, x, op, depth);
|
||||||
if (!sexp_exceptionp(res))
|
|
||||||
res = analyze(ctx, res, depth, defok);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ref = analyze_var_ref(ctx, sexp_cadr(x), &varenv);
|
ref = analyze_var_ref(ctx, sexp_cadr(x), &varenv);
|
||||||
|
@ -1124,7 +1122,12 @@ static sexp analyze (sexp ctx, sexp object, int depth, int defok) {
|
||||||
: sexp_compile_error(ctx, "unexpected define", x);
|
: sexp_compile_error(ctx, "unexpected define", x);
|
||||||
break;
|
break;
|
||||||
case SEXP_CORE_SET:
|
case SEXP_CORE_SET:
|
||||||
res = analyze_set(ctx, x, depth, defok); break;
|
x = analyze_set(ctx, x, depth);
|
||||||
|
if (!sexp_exceptionp(x) && !sexp_setp(x))
|
||||||
|
goto loop;
|
||||||
|
else
|
||||||
|
res = x;
|
||||||
|
break;
|
||||||
case SEXP_CORE_LAMBDA:
|
case SEXP_CORE_LAMBDA:
|
||||||
res = analyze_lambda(ctx, x, depth); break;
|
res = analyze_lambda(ctx, x, depth); break;
|
||||||
case SEXP_CORE_IF:
|
case SEXP_CORE_IF:
|
||||||
|
|
Loading…
Add table
Reference in a new issue