strip syntactic-closures in quoted vectors (fixes issue #389)

This commit is contained in:
Alex Shinn 2017-01-14 16:34:16 +09:00
parent 789b448e54
commit 2f1b730f65
2 changed files with 10 additions and 0 deletions

4
eval.c
View file

@ -618,6 +618,7 @@ static int sexp_cyclic_synclop(sexp x) {
#endif
sexp sexp_strip_synclos_bound (sexp ctx, sexp x, int depth) {
int i;
sexp_gc_var3(res, kar, kdr);
if (depth <= 0) return x;
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_immutablep(res) = 1;
} 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;
}
sexp_gc_release3(ctx);

View file

@ -534,6 +534,12 @@
(ffoo ff)
(test 100 (ff 10)))
(let-syntax ((vector-lit
(syntax-rules ()
((vector-lit)
'#(b)))))
(test '#(b) (vector-lit)))
(test-end)
(test-begin "5 Program structure")