@@ -12472,7 +12472,7 @@ reduces them without incurring seq initialization"
12472
12472
(-kv-reduce coll
12473
12473
(fn [ret k v]
12474
12474
(-assoc ret k v))
12475
- (. HashMap -EMPTY ))
12475
+ (simple-hash-map k v ))
12476
12476
meta))))
12477
12477
(-contains-key? [coll k]
12478
12478
(let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
@@ -12628,11 +12628,12 @@ reduces them without incurring seq initialization"
12628
12628
(-assoc [coll k v]
12629
12629
(let [h (hash k)
12630
12630
bucket (unchecked-get hashobj h)]
12631
- (if bucket
12631
+ (if ( some? bucket)
12632
12632
(let [new-bucket (aclone bucket)
12633
- new-hashobj (gobject/clone hashobj)]
12633
+ new-hashobj (gobject/clone hashobj)
12634
+ i (scan-array-equiv 2 k new-bucket)]
12634
12635
(aset new-hashobj h new-bucket)
12635
- (if-let [i ( scan-array-equiv 2 k new-bucket)]
12636
+ (if ( some? i)
12636
12637
(do
12637
12638
; found key, replace
12638
12639
(aset new-bucket (inc i) v)
@@ -12641,7 +12642,8 @@ reduces them without incurring seq initialization"
12641
12642
; did not find key, append
12642
12643
(.push new-bucket k v)
12643
12644
(HashMap. meta (inc count) new-hashobj nil ))))
12644
- (let [new-hashobj (gobject/clone hashobj)] ; did not find bucket
12645
+ (let [new-hashobj (gobject/clone hashobj)]
12646
+ ; did not find bucket
12645
12647
(unchecked-set new-hashobj h (array k v))
12646
12648
(HashMap. meta (inc count) new-hashobj nil )))))
12647
12649
(-contains-key? [coll k]
@@ -12656,15 +12658,16 @@ reduces them without incurring seq initialization"
12656
12658
(let [h (hash k)
12657
12659
bucket (unchecked-get hashobj h)
12658
12660
i (when bucket (scan-array-equiv 2 k bucket))]
12659
- (if (not i)
12660
- coll ; key not found, return coll unchanged
12661
+ (if (some? i)
12661
12662
(let [new-hashobj (gobject/clone hashobj)]
12662
12663
(if (> 3 (alength bucket))
12663
12664
(js-delete new-hashobj h)
12664
12665
(let [new-bucket (aclone bucket)]
12665
12666
(.splice new-bucket i 2 )
12666
12667
(unchecked-set new-hashobj h new-bucket)))
12667
- (HashMap. meta (dec count) new-hashobj nil )))))
12668
+ (HashMap. meta (dec count) new-hashobj nil ))
12669
+ ; key not found, return coll unchanged
12670
+ coll)))
12668
12671
12669
12672
IFn
12670
12673
(-invoke [coll k]
0 commit comments