Skip to content

Commit 6b453ef

Browse files
committed
same treatment for HashMap and Set
1 parent ba268a1 commit 6b453ef

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12816,10 +12816,12 @@ reduces them without incurring seq initialization"
1281612816
i (scan-array-equiv 2 k new-bucket)]
1281712817
(aset new-hashobj h new-bucket)
1281812818
(if (some? i)
12819-
(do
12820-
; found key, replace
12821-
(aset new-bucket (inc i) v)
12822-
(HashMap. meta count new-hashobj nil))
12819+
(if (identical? v (aget new-bucket (inc i)))
12820+
coll
12821+
(do
12822+
; found key, replace
12823+
(aset new-bucket (inc i) v)
12824+
(HashMap. meta count new-hashobj nil)))
1282312825
(do
1282412826
; did not find key, append
1282512827
(.push new-bucket k v)
@@ -12958,7 +12960,10 @@ reduces them without incurring seq initialization"
1295812960

1295912961
ICollection
1296012962
(-conj [coll o]
12961-
(Set. meta (assoc hash-map o o) nil))
12963+
(let [new-hash-map (assoc hash-map o o)]
12964+
(if (identical? new-hash-map hash-map)
12965+
coll
12966+
(Set. meta new-hash-map nil))))
1296212967

1296312968
IEmptyableCollection
1296412969
(-empty [coll] (with-meta (. Set -EMPTY) meta))

0 commit comments

Comments
 (0)