summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
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;
}