diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-02 08:44:08 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-02 08:44:08 -0700 |
commit | 1f6d6acb5b8ed75776249d3032477050ebb92a9a (patch) | |
tree | 47c2d1d28f978e7d660b404036cebe98a919ae53 | |
parent | b434af5cb21ac4bf8e78639c15fadde9f66f5068 (diff) | |
download | txr-1f6d6acb5b8ed75776249d3032477050ebb92a9a.tar.gz txr-1f6d6acb5b8ed75776249d3032477050ebb92a9a.tar.bz2 txr-1f6d6acb5b8ed75776249d3032477050ebb92a9a.zip |
compiler: bugfix: missing case in cond.
* share/txr/stdlib/compiler.tl (compiler comp-cond): Add
handling for the case when the cond clause contains only a
test form, and no additional forms. In that case, if the
value is true, then cond terminates with that value. We can
nicely achieve this by using or. This was uncovered while
compiling share/txr/stdlib/awk.tl, which contains such a
case in (sys:awk-state loop) that handles opening the
input source.
-rw-r--r-- | share/txr/stdlib/compiler.tl | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index fd315944..907055ad 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -313,6 +313,7 @@ (defmeth compiler comp-cond (me oreg env form) (tree-case form ((op) me.(comp-atom oreg nil)) + ((op (test) . more) me.(compile oreg env ^(or ,test (cond ,*more)))) ((op (test . forms) . more) me.(compile oreg env ^(if ,test (progn ,*forms) |