Skip to content

Commit

Permalink
fix bug in hash cache code, check that the result is a number.
Browse files Browse the repository at this point in the history
  • Loading branch information
swannodette committed Apr 15, 2013
1 parent a1b41be commit d10c702
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cljs/cljs/core.cljs
Expand Up @@ -968,12 +968,14 @@ reduces them without incurring seq initialization"
(set! string-hash-cache-count (inc string-hash-cache-count))
h))

(declare number?)

(defn check-string-hash-cache [k]
(when (> string-hash-cache-count 255)
(set! string-hash-cache (js-obj))
(set! string-hash-cache-count 0))
(let [h (aget string-hash-cache k)]
(if-not (nil? h)
(if (number? h)
h
(add-to-string-hash-cache k))))

Expand Down

0 comments on commit d10c702

Please sign in to comment.