Skip to content

Commit bee66e0

Browse files
mfikesdnolen
authored andcommitted
CLJS-2335: Avoid alength on strings
1 parent 79041d1 commit bee66e0

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/main/cljs/cljs/core.cljs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -923,17 +923,17 @@
923923

924924
(defn ^number m3-hash-unencoded-chars [in]
925925
(let [h1 (loop [i 1 h1 m3-seed]
926-
(if (< i (alength in))
926+
(if (< i (.-length in))
927927
(recur (+ i 2)
928928
(m3-mix-H1 h1
929929
(m3-mix-K1
930930
(bit-or (.charCodeAt in (dec i))
931931
(bit-shift-left (.charCodeAt in i) 16)))))
932932
h1))
933-
h1 (if (== (bit-and (alength in) 1) 1)
934-
(bit-xor h1 (m3-mix-K1 (.charCodeAt in (dec (alength in)))))
933+
h1 (if (== (bit-and (.-length in) 1) 1)
934+
(bit-xor h1 (m3-mix-K1 (.charCodeAt in (dec (.-length in)))))
935935
h1)]
936-
(m3-fmix h1 (imul 2 (alength in)))))
936+
(m3-fmix h1 (imul 2 (.-length in)))))
937937

938938
;;;;;;;;;;;;;;;;;;; symbols ;;;;;;;;;;;;;;;
939939

@@ -946,7 +946,7 @@
946946
;;http://hg.openjdk.java.net/jdk7u/jdk7u6/jdk/file/8c2c5d63a17e/src/share/classes/java/lang/String.java
947947
(defn hash-string* [s]
948948
(if-not (nil? s)
949-
(let [len (alength s)]
949+
(let [len (.-length s)]
950950
(if (pos? len)
951951
(loop [i 0 hash 0]
952952
(if (< i len)
@@ -1798,7 +1798,7 @@ reduces them without incurring seq initialization"
17981798
(alength coll)
17991799

18001800
(string? coll)
1801-
(alength coll)
1801+
(.-length coll)
18021802

18031803
(implements? ISeqable coll)
18041804
(accumulating-seq-count coll)
@@ -3953,7 +3953,7 @@ reduces them without incurring seq initialization"
39533953

39543954
(deftype StringIter [s ^:mutable i]
39553955
Object
3956-
(hasNext [_] (< i (alength s)))
3956+
(hasNext [_] (< i (.-length s)))
39573957
(next [_]
39583958
(let [ret (.charAt s i)]
39593959
(set! i (inc i))

0 commit comments

Comments
 (0)