diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-10-21 20:37:03 -0400 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-10-21 20:37:03 -0400 |
commit | 3f116ba6a398244dfc8b202dfc4087b92bbaabb4 (patch) | |
tree | 3e1b4fdc37bfc8cb8a14f009a96e73e51c84d6e5 /match.c | |
parent | d1cd4c2cd7957cb22282905f7a41cd34b6db08ed (diff) | |
download | txr-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.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; } |