summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-10-21 20:37:03 -0400
committerKaz Kylheku <kaz@kylheku.com>2011-10-21 20:37:03 -0400
commit3f116ba6a398244dfc8b202dfc4087b92bbaabb4 (patch)
tree3e1b4fdc37bfc8cb8a14f009a96e73e51c84d6e5 /match.c
parentd1cd4c2cd7957cb22282905f7a41cd34b6db08ed (diff)
downloadtxr-3f116ba6a398244dfc8b202dfc4087b92bbaabb4.tar.gz
txr-3f116ba6a398244dfc8b202dfc4087b92bbaabb4.tar.bz2
txr-3f116ba6a398244dfc8b202dfc4087b92bbaabb4.zip
* 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.
Diffstat (limited to 'match.c')
-rw-r--r--match.c22
1 files changed, 22 insertions, 0 deletions
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;
}