making literals embedded in the source immutable

This commit is contained in:
Alex Shinn 2012-06-10 14:22:22 +09:00
parent 638558ebe0
commit 8d5ea4cdf4

2
eval.c
View file

@ -928,6 +928,8 @@ static sexp analyze (sexp ctx, sexp object) {
} else if (sexp_nullp(x)) { } else if (sexp_nullp(x)) {
res = sexp_compile_error(ctx, "empty application in source", x); res = sexp_compile_error(ctx, "empty application in source", x);
} else { } else {
if (sexp_pointerp(x)) /* accept vectors and other literals directly, */
sexp_immutablep(x) = 1; /* but they must be immutable */
res = x; res = x;
} }
if (sexp_exceptionp(res) && sexp_not(sexp_exception_source(res)) if (sexp_exceptionp(res) && sexp_not(sexp_exception_source(res))