Skip to content

Commit f329097

Browse files
committed
- modernize HashMap
1 parent ae604a4 commit f329097

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12527,7 +12527,7 @@ reduces them without incurring seq initialization"
1252712527
bucket (aget hashobj h)]
1252812528
(if bucket
1252912529
(let [new-bucket (aclone bucket)
12530-
new-hashobj (goog.object/clone hashobj)]
12530+
new-hashobj (gobject/clone hashobj)]
1253112531
(aset new-hashobj h new-bucket)
1253212532
(if-let [i (scan-array 2 k new-bucket)]
1253312533
(do ; found key, replace
@@ -12536,11 +12536,11 @@ reduces them without incurring seq initialization"
1253612536
(do ; did not find key, append
1253712537
(.push new-bucket k v)
1253812538
(HashMap. meta (inc count) new-hashobj nil))))
12539-
(let [new-hashobj (goog.object/clone hashobj)] ; did not find bucket
12540-
(aset new-hashobj h (array k v))
12539+
(let [new-hashobj (gobject/clone hashobj)] ; did not find bucket
12540+
(unchecked-set new-hashobj h (array k v))
1254112541
(HashMap. meta (inc count) new-hashobj nil)))))
1254212542
(-contains-key? [coll k]
12543-
(let [bucket (aget hashobj (hash k))
12543+
(let [bucket (unchecked-get hashobj (hash k))
1254412544
i (when bucket (scan-array 2 k bucket))]
1254512545
(if i
1254612546
true
@@ -12549,16 +12549,16 @@ reduces them without incurring seq initialization"
1254912549
IMap
1255012550
(-dissoc [coll k]
1255112551
(let [h (hash k)
12552-
bucket (aget hashobj h)
12552+
bucket (unchecked-get hashobj h)
1255312553
i (when bucket (scan-array 2 k bucket))]
1255412554
(if (not i)
1255512555
coll ; key not found, return coll unchanged
12556-
(let [new-hashobj (goog.object/clone hashobj)]
12557-
(if (> 3 (.-length bucket))
12556+
(let [new-hashobj (gobject/clone hashobj)]
12557+
(if (> 3 (alength bucket))
1255812558
(js-delete new-hashobj h)
1255912559
(let [new-bucket (aclone bucket)]
1256012560
(.splice new-bucket i 2)
12561-
(aset new-hashobj h new-bucket)))
12561+
(unchecked-set new-hashobj h new-bucket)))
1256212562
(HashMap. meta (dec count) new-hashobj nil)))))
1256312563

1256412564
IFn

0 commit comments

Comments
 (0)