summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-05 23:58:25 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-05 23:58:25 -0800
commitaedc0968e049bc907c0407175f7118451e4fefad (patch)
tree7a52ec69cae785d67b3420cc2773aa3b544221bb
parent89c912f4829c96db3d6e2ce1ce468156ca97e2e3 (diff)
downloadtxr-aedc0968e049bc907c0407175f7118451e4fefad.tar.gz
txr-aedc0968e049bc907c0407175f7118451e4fefad.tar.bz2
txr-aedc0968e049bc907c0407175f7118451e4fefad.zip
matcher: clean up var match.
* share/txr/stdlib/match.tl (compile-var-match): Pull symbol check into the cond. In null sym case, don't call var-list.record.
-rw-r--r--share/txr/stdlib/match.tl10
1 files changed, 6 insertions, 4 deletions
diff --git a/share/txr/stdlib/match.tl b/share/txr/stdlib/match.tl
index f40fbd70..ab12ef7d 100644
--- a/share/txr/stdlib/match.tl
+++ b/share/txr/stdlib/match.tl
@@ -185,11 +185,13 @@
(mappend .guard-chain slot-matches))))))
(defun compile-var-match (sym obj-var var-list)
- (or (null sym) (bindable sym)
- (compile-error *match-form* "~s is not a bindable symbol" sym))
(cond
- ((or (null sym)
- (not var-list.(exists sym)))
+ ((null sym)
+ (new compiled-match
+ obj-var obj-var))
+ ((not (bindable sym))
+ (compile-error *match-form* "~s is not a bindable symbol" sym))
+ ((not var-list.(exists sym))
var-list.(record sym)
(new compiled-match
pattern sym