diff options
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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; } |