Skip to content

Commit

Permalink
CCACHE-1: Guarding lookup with has? check
Browse files Browse the repository at this point in the history
  • Loading branch information
fogus committed Nov 29, 2011
1 parent dbede28 commit 7f77aee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/clojure/clojure/core/cache.clj
Expand Up @@ -43,8 +43,8 @@
(valAt [this# key#] (valAt [this# key#]
(lookup this# key#)) (lookup this# key#))
(valAt [this# key# not-found#] (valAt [this# key# not-found#]
(if-let [res# (lookup this# key#)] (if (has? this# key#)
res# (lookup this# key#)
not-found#)) not-found#))


clojure.lang.IPersistentMap clojure.lang.IPersistentMap
Expand Down
6 changes: 3 additions & 3 deletions src/test/clojure/clojure/core/cache/tests.clj
Expand Up @@ -34,7 +34,7 @@
(get c :e) nil (get c :e) nil
(get c :e 0) 0 (get c :e 0) 0
(get c :b 0) 2 (get c :b 0) 2
;; (get c :f 0) nil (get c :f 0) nil


(get-in c [:c :e]) 4 (get-in c [:c :e]) 4
(get-in c '(:c :e)) 4 (get-in c '(:c :e)) 4
Expand All @@ -49,8 +49,8 @@
(get-in c '(:c :e) 0) 4 (get-in c '(:c :e) 0) 4
(get-in c [:c :x] 0) 0 (get-in c [:c :x] 0) 0
(get-in c [:b] 0) 2 (get-in c [:b] 0) 2
;; (get-in c [:f] 0) nil (get-in c [:f] 0) nil
;; (get-in c [:g] 0) false (get-in c [:g] 0) false
(get-in c [:h] 0) 0 (get-in c [:h] 0) 0
(get-in c [:x :y] {:y 1}) {:y 1} (get-in c [:x :y] {:y 1}) {:y 1}
(get-in c [] 0) c (get-in c [] 0) c
Expand Down

0 comments on commit 7f77aee

Please sign in to comment.