~ chicken-core (chicken-5) f40cdd54a54acee76d99799a8cd99a49b58ad226
commit f40cdd54a54acee76d99799a8cd99a49b58ad226
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Sun Sep 15 18:29:41 2019 +0200
Commit: Peter Bex <peter@more-magic.net>
CommitDate: Sun Sep 15 18:29:41 2019 +0200
Remove unnecessary boolean test on db-get-list results
The result of db-get-list is guaranteed to always be a list, so no
need to check for booleanness.
This is a silly small improvement, but it improves readability.
diff --git a/optimizer.scm b/optimizer.scm
index 33debaab..fc2d3165 100644
--- a/optimizer.scm
+++ b/optimizer.scm
@@ -593,7 +593,7 @@
(krefs (db-get-list db kont 'references)) )
;; Call-site has one argument and a known continuation (which is a ##core#lambda)
;; that has only one use:
- (when (and lnode krefs (= 1 (length krefs)) (= 3 (length subs))
+ (when (and lnode (= 1 (length krefs)) (= 3 (length subs))
(eq? '##core#lambda (node-class lnode)) )
(let* ((llist (third (node-parameters lnode)))
(body (first (node-subexpressions lnode)))
@@ -603,7 +603,7 @@
(let* ((var (car llist))
(refs (db-get-list db var 'references)) )
;; Parameter is only used once?
- (if (and refs (= 1 (length refs)) (eq? 'if (node-class body)))
+ (if (and (= 1 (length refs)) (eq? 'if (node-class body)))
;; Continuation contains an 'if' node?
(let ((iftest (first (node-subexpressions body))))
;; Parameter is used only once and is the test-argument?
Trap