From 306d30c4b652fc3811d0a82b59d0cc5a8b58cfdf Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 25 Feb 2012 16:46:36 -0800 Subject: Bug #34652 * match.c (do_txeval): Establish a dynamic env frame around evaluation of quasiliteral and around embedded TXR Lisp expression (which may contain quasiliterals) and stick the bindings there via set_match_context. This way if filte functions are invoked through a quasiliteral, they can see bindings. --- ChangeLog | 10 ++++++++++ match.c | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5f400108..44f4403b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-02-25 Kaz Kylheku + + Bug #34652 + + * match.c (do_txeval): Establish a dynamic env frame around + evaluation of quasiliteral and around embedded TXR Lisp expression + (which may contain quasiliterals) and stick the bindings there + via set_match_context. This way if filte functions are invoked through + a quasiliteral, they can see bindings. + 2012-02-25 Kaz Kylheku * eval.c (eval_init): New put-byte function interned. diff --git a/match.c b/match.c index 08281050..855cdd4d 100644 --- a/match.c +++ b/match.c @@ -1374,14 +1374,20 @@ static val do_txeval(val spec, val form, val bindings, val allow_unbound) } } else if (consp(form)) { if (first(form) == quasi_s) { + uw_env_begin; + uw_set_match_context(cons(spec, bindings)); ret = cat_str(subst_vars(rest(form), bindings, nil), nil); + uw_env_end; } else if (regexp(car(form))) { ret = form; } else if (first(form) == var_s) { sem_error(spec, lit("metavariable @~s syntax cannot be used here"), second(form), nao); } else if (first(form) == expr_s) { + uw_env_begin; + uw_set_match_context(cons(spec, bindings)); ret = eval(rest(form), make_env(bindings, nil, nil), form); + uw_env_end; } else { ret = mapcar(curry_123_2(func_n3(txeval), spec, bindings), form); } -- cgit v1.2.3