Skip to content

Commit 8eae380

Browse files
committed
- remove doseq from printing
- don't leak internal key rep from ObjMap
1 parent 393a594 commit 8eae380

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10347,8 +10347,10 @@ reduces them without incurring seq initialization"
1034710347
(-write writer end)))))
1034810348

1034910349
(defn write-all [writer & ss]
10350-
(doseq [s ss]
10351-
(-write writer s)))
10350+
(loop [ss (seq ss)]
10351+
(when-not (nil? ss)
10352+
(-write writer (first ss))
10353+
(recur (next ss)))))
1035210354

1035310355
(defn string-print [x]
1035410356
(when (nil? *print-fn*)
@@ -10509,9 +10511,11 @@ reduces them without incurring seq initialization"
1050910511

1051010512
(defn pr-seq-writer [objs writer opts]
1051110513
(pr-writer (first objs) writer opts)
10512-
(doseq [obj (next objs)]
10513-
(-write writer " ")
10514-
(pr-writer obj writer opts)))
10514+
(loop [objs (next objs)]
10515+
(when-not (nil? objs)
10516+
(-write writer " ")
10517+
(pr-writer (first objs) writer opts)
10518+
(recur (next objs)))))
1051510519

1051610520
(defn- pr-sb-with-opts [objs opts]
1051710521
(let [sb (StringBuffer.)
@@ -12402,6 +12406,12 @@ reduces them without incurring seq initialization"
1240212406
[k]
1240312407
(str "\uFDD0" "'" (. k -fqn)))
1240412408

12409+
(defn- obj-map-key->keyword
12410+
[k]
12411+
(if (.startsWith k "\uFDD0")
12412+
(keyword (.substring k 2 (. k -length)))
12413+
k))
12414+
1240512415
(deftype ObjMap [meta keys strobj ^:mutable __hash]
1240612416
IWithMeta
1240712417
(-with-meta [coll meta] (ObjMap. meta keys strobj __hash))
@@ -12429,7 +12439,7 @@ reduces them without incurring seq initialization"
1242912439
(when (pos? (alength keys))
1243012440
(prim-seq
1243112441
(.map (.sort keys obj-map-compare-keys)
12432-
#(simple-map-entry % (unchecked-get strobj %))))))
12442+
#(simple-map-entry (obj-map-key->keyword %) (unchecked-get strobj %))))))
1243312443

1243412444
ICounted
1243512445
(-count [coll] (alength keys))
@@ -12484,7 +12494,7 @@ reduces them without incurring seq initialization"
1248412494
init init]
1248512495
(if (seq keys)
1248612496
(let [k (first keys)
12487-
init (f init k (unchecked-get strobj k))]
12497+
init (f init (obj-map-key->keyword k) (unchecked-get strobj k))]
1248812498
(if (reduced? init)
1248912499
@init
1249012500
(recur (rest keys) init)))
@@ -12494,7 +12504,7 @@ reduces them without incurring seq initialization"
1249412504
(-dissoc [coll k]
1249512505
(let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
1249612506
(if (and (string? k)
12497-
(not (nil? (scan-array 1 k keys))))
12507+
(not (nil? (scan-array 1 k keys))))
1249812508
(let [new-keys (aclone keys)
1249912509
new-strobj (obj-clone strobj keys)]
1250012510
(.splice new-keys (scan-array 1 k new-keys) 1)

0 commit comments

Comments
 (0)