summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-02-06 06:49:29 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-02-06 06:49:29 -0800
commitff958087cf0e483ac592dc4c41023165d95f9778 (patch)
tree4630cc0869e3133e4548fb7efd5c1784fb9a1972 /eval.c
parentb0d0ba0657ff67cdc29bee3b305c3c72f55725f7 (diff)
downloadtxr-ff958087cf0e483ac592dc4c41023165d95f9778.tar.gz
txr-ff958087cf0e483ac592dc4c41023165d95f9778.tar.bz2
txr-ff958087cf0e483ac592dc4c41023165d95f9778.zip
* eval.c (transform_op): When expanding @rest and metanums
like @1, @2, preserve the (sys:var X args ..) structure if there are args (but of course with X replaced by the appropriate gensym). This allows syntax like `@{1 10}` to work in quasiliterals: in other words, modifiers on interpolated metas, on par with @{a 10}.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 9def9db9..eaa7960f 100644
--- a/eval.c
+++ b/eval.c
@@ -2515,11 +2515,15 @@ static val transform_op(val forms, val syms, val rg)
val sym = cdr(if3(new_p,
rplacd(cell, gensym(format_op_arg(vararg))),
cell));
+ val sym_form = if3(cdr(cdr(fi)),
+ cons(var_s, cons(sym, cdr(cdr(fi)))), sym);
cons_bind (outsyms, outforms, transform_op(re, newsyms, rg));
- return cons(outsyms, rlcp(cons(sym, outforms), outforms));
+ return cons(outsyms, rlcp(cons(sym_form, outforms), outforms));
} else if (vararg == rest_s) {
+ val sym_form = if3(cdr(cdr(fi)),
+ cons(var_s, cons(rg, cdr(cdr(fi)))), rg);
cons_bind (outsyms, outforms, transform_op(re, syms, rg));
- return cons(outsyms, rlcp(cons(rg, outforms), outforms));
+ return cons(outsyms, rlcp(cons(sym_form, outforms), outforms));
}
}