File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -12503,6 +12503,15 @@ reduces them without incurring seq initialization"
12503
12503
i
12504
12504
(recur (+ i incr)))))))
12505
12505
12506
+ (deftype ObjMapIterator [strkeys strobj ^:mutable i]
12507
+ Object
12508
+ (hasNext [_]
12509
+ (< i (alength strkeys)))
12510
+ (next [_]
12511
+ (let [k (aget strkeys i)]
12512
+ (set! i (inc i))
12513
+ (simple-map-entry (obj-map-key->keyword k) (unchecked-get strobj k)))))
12514
+
12506
12515
(deftype ObjMap [meta strkeys strobj ^:mutable __hash]
12507
12516
Object
12508
12517
(toString [coll]
@@ -12617,6 +12626,16 @@ reduces them without incurring seq initialization"
12617
12626
(recur (rest keys) init)))
12618
12627
init))))
12619
12628
12629
+ IIterable
12630
+ (-iterator [coll]
12631
+ (ObjMapIterator. strkeys strobj 0 ))
12632
+
12633
+ IReduce
12634
+ (-reduce [coll f]
12635
+ (iter-reduce coll f))
12636
+ (-reduce [coll f start]
12637
+ (iter-reduce coll f start))
12638
+
12620
12639
IMap
12621
12640
(-dissoc [coll k]
12622
12641
(let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
@@ -12847,6 +12866,26 @@ reduces them without incurring seq initialization"
12847
12866
(-iterator xs)
12848
12867
(nil-iter ))))
12849
12868
12869
+ IKVReduce
12870
+ (-kv-reduce [coll f init]
12871
+ (let [hashes (.sort (js-keys hashobj))
12872
+ ilen (alength hashes)]
12873
+ (loop [i 0 init init]
12874
+ (if (< i ilen)
12875
+ (let [bckt (unchecked-get hashobj (aget hashes i))
12876
+ jlen (alength bckt)
12877
+ init (loop [j 0 init init]
12878
+ (if (< j jlen)
12879
+ (let [init (f init (aget bckt j) (aget bckt (inc j)))]
12880
+ (if (reduced? init)
12881
+ init
12882
+ (recur (+ j 2 ) init)))
12883
+ init))]
12884
+ (if (reduced? init)
12885
+ @init
12886
+ (recur (inc i) init)))
12887
+ init))))
12888
+
12850
12889
IPrintWithWriter
12851
12890
(-pr-writer [coll writer opts]
12852
12891
(print-map coll pr-writer writer opts)))
Original file line number Diff line number Diff line change 96
96
'cljs.letfn-test
97
97
'foo.ns-shadow-test
98
98
'cljs.top-level
99
- #_ 'cljs.reducers-test ; ; missing IReduce, IKVReduce
99
+ 'cljs.reducers-test ; ; missing IReduce, IKVReduce
100
100
'cljs.keyword-test
101
101
'cljs.import-test
102
102
'cljs.ns-test.foo
You can’t perform that action at this time.
0 commit comments