From 3f116ba6a398244dfc8b202dfc4087b92bbaabb4 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 21 Oct 2011 20:37:03 -0400 Subject: * match.c (v_collect): Regression bugfix. Make it work like the comment says: until/last clause has visibility to uncollated bindings from collect. * txr.1: Document behavior. --- match.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'match.c') diff --git a/match.c b/match.c index 894f6d73..174c2a1c 100644 --- a/match.c +++ b/match.c @@ -776,6 +776,17 @@ next_coll: c.bindings = nappend2(last_bindings, c.bindings); } + /* If nothing was collected, but vars were specified, + then bind empty lists for the vars. */ + if (!bindings_coll && vars) { + for (iter = vars; iter; iter = cdr(iter)) { + val sym = car(car(iter)); + val exists = assoc(c.bindings, sym); + if (!exists) + c.bindings = acons(c.bindings, sym, nil); + } + } + *cout = c; return next_spec_k; } @@ -2043,6 +2054,17 @@ next_collect: c.bindings = nappend2(last_bindings, c.bindings); } + /* If nothing was collected, but vars were specified, + then bind empty lists for the vars. */ + if (!bindings_coll && vars) { + for (iter = vars; iter; iter = cdr(iter)) { + val sym = car(car(iter)); + val exists = assoc(c.bindings, sym); + if (!exists) + c.bindings = acons(c.bindings, sym, nil); + } + } + *cout = c; return next_spec_k; } -- cgit v1.2.3