Skip to content

Commit c1356ce

Browse files
committed
make the choice more static, not sure what's going on
1 parent 7e11286 commit c1356ce

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4129,13 +4129,21 @@ reduces them without incurring seq initialization"
41294129
;; CLJS-3200: used by destructure macro for maps to reduce amount of repeated code
41304130
;; placed here because it needs apply and hash-map (only declared at this point)
41314131
(defn --destructure-map [gmap]
4132-
(if (implements? ISeq gmap)
4133-
(if (next gmap)
4134-
(.createAsIfByAssoc (if ^boolean LITE_MODE ObjMap PersistentArrayMap) (to-array gmap))
4135-
(if (seq gmap)
4136-
(first gmap)
4137-
{}))
4138-
gmap))
4132+
(if ^boolean LITE_MODE
4133+
(if (implements? ISeq gmap)
4134+
(if (next gmap)
4135+
(.createAsIfByAssoc ObjMap (to-array gmap))
4136+
(if (seq gmap)
4137+
(first gmap)
4138+
(.-EMPTY ObjMap)))
4139+
gmap)
4140+
(if (implements? ISeq gmap)
4141+
(if (next gmap)
4142+
(.createAsIfByAssoc PersistentArrayMap (to-array gmap))
4143+
(if (seq gmap)
4144+
(first gmap)
4145+
(.-EMPTY PersistentArrayMap)))
4146+
gmap)))
41394147

41404148
(defn vary-meta
41414149
"Returns an object of the same type and value as obj, with
@@ -9041,9 +9049,13 @@ reduces them without incurring seq initialization"
90419049
"Builds a map from a seq as described in
90429050
https://clojure.org/reference/special_forms#keyword-arguments"
90439051
[s]
9044-
(if (next s)
9045-
(.createAsIfByAssoc (if ^boolean LITE_MODE ObjMap PersistentArrayMap) (to-array s))
9046-
(if (seq s) (first s) {})))
9052+
(if ^boolean LITE_MODE
9053+
(if (next s)
9054+
(.createAsIfByAssoc ObjMap (to-array s))
9055+
(if (seq s) (first s) (.-EMPTY ObjMap)))
9056+
(if (next s)
9057+
(.createAsIfByAssoc PersistentArrayMap (to-array s))
9058+
(if (seq s) (first s) (.-EMPTY PersistentArrayMap)))))
90479059

90489060
(defn sorted-map
90499061
"keyval => key val
@@ -12733,7 +12745,7 @@ reduces them without incurring seq initialization"
1273312745
(recur (nnext kvs)))
1273412746
(.fromObject ObjMap ks obj)))))
1273512747

12736-
(set! (.-createAsIfByAssoc ObjMap)
12748+
(set! (. ObjMap -createAsIfByAssoc)
1273712749
(fn [init]
1273812750
;; check trailing element
1273912751
(let [len (alength init)

0 commit comments

Comments
 (0)