mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
strip syntactic-closures in quoted vectors (fixes issue #389)
This commit is contained in:
parent
789b448e54
commit
2f1b730f65
2 changed files with 10 additions and 0 deletions
4
eval.c
4
eval.c
|
@ -618,6 +618,7 @@ static int sexp_cyclic_synclop(sexp x) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sexp sexp_strip_synclos_bound (sexp ctx, sexp x, int depth) {
|
sexp sexp_strip_synclos_bound (sexp ctx, sexp x, int depth) {
|
||||||
|
int i;
|
||||||
sexp_gc_var3(res, kar, kdr);
|
sexp_gc_var3(res, kar, kdr);
|
||||||
if (depth <= 0) return x;
|
if (depth <= 0) return x;
|
||||||
sexp_gc_preserve3(ctx, res, kar, kdr);
|
sexp_gc_preserve3(ctx, res, kar, kdr);
|
||||||
|
@ -629,6 +630,9 @@ sexp sexp_strip_synclos_bound (sexp ctx, sexp x, int depth) {
|
||||||
sexp_pair_source(res) = sexp_pair_source(x);
|
sexp_pair_source(res) = sexp_pair_source(x);
|
||||||
sexp_immutablep(res) = 1;
|
sexp_immutablep(res) = 1;
|
||||||
} else {
|
} else {
|
||||||
|
if (sexp_vectorp(x))
|
||||||
|
for (i = 0; i < sexp_vector_length(x); ++i)
|
||||||
|
sexp_vector_set(x, sexp_make_fixnum(i), sexp_strip_synclos_bound(ctx, sexp_vector_ref(x, sexp_make_fixnum(i)), depth-1));
|
||||||
res = x;
|
res = x;
|
||||||
}
|
}
|
||||||
sexp_gc_release3(ctx);
|
sexp_gc_release3(ctx);
|
||||||
|
|
|
@ -534,6 +534,12 @@
|
||||||
(ffoo ff)
|
(ffoo ff)
|
||||||
(test 100 (ff 10)))
|
(test 100 (ff 10)))
|
||||||
|
|
||||||
|
(let-syntax ((vector-lit
|
||||||
|
(syntax-rules ()
|
||||||
|
((vector-lit)
|
||||||
|
'#(b)))))
|
||||||
|
(test '#(b) (vector-lit)))
|
||||||
|
|
||||||
(test-end)
|
(test-end)
|
||||||
|
|
||||||
(test-begin "5 Program structure")
|
(test-begin "5 Program structure")
|
||||||
|
|
Loading…
Add table
Reference in a new issue