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
commit9ae3eed9230f44695b87c2a0fc6ea4a3a3a42ed1 (patch)
tree7a52ec69cae785d67b3420cc2773aa3b544221bb
parent79b3a51396f069b8775a0f71849b821cb9627b29 (diff)
downloadtxr-9ae3eed9230f44695b87c2a0fc6ea4a3a3a42ed1.tar.gz
txr-9ae3eed9230f44695b87c2a0fc6ea4a3a3a42ed1.tar.bz2
txr-9ae3eed9230f44695b87c2a0fc6ea4a3a3a42ed1.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