Skip to content

Commit 2940738

Browse files
committed
LITE_MODE goog-define so we can elide chunked logic from std lib
1 parent de3b500 commit 2940738

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@
5353
, and \"global\" supported. "}
5454
*global* "default")
5555

56+
(goog-define
57+
^{:doc "Boolean flag for LITE_MODE"
58+
:jsdoc ["@type {boolean}"]}
59+
LITE_MODE false)
60+
5661
(def
5762
^{:dynamic true
5863
:doc "Var bound to the current namespace. Only used for bootstrapping."
@@ -2262,7 +2267,10 @@ reduces them without incurring seq initialization"
22622267

22632268
(defn chunked-seq?
22642269
"Return true if x satisfies IChunkedSeq."
2265-
[x] (implements? IChunkedSeq x))
2270+
[x]
2271+
(if-not ^boolean LITE_MODE
2272+
(implements? IChunkedSeq x)
2273+
false))
22662274

22672275
;;;;;;;;;;;;;;;;;;;; js primitives ;;;;;;;;;;;;
22682276
(defn js-obj
@@ -12506,7 +12514,7 @@ reduces them without incurring seq initialization"
1250612514
(-seq [coll]
1250712515
(when (pos? count)
1250812516
(let [hashes (.sort (js-keys hashobj))]
12509-
(mapcat #(map vec (partition 2 (aget hashobj %)))
12517+
(mapcat #(map (fn [[k v]] (MapEntry. k v)) (partition 2 (unchecked-get hashobj %)))
1251012518
hashes))))
1251112519

1251212520
ICounted

src/main/clojure/cljs/closure.clj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,6 +2519,10 @@
25192519
:cache-analysis-format (:cache-analysis-format opts :transit))
25202520
(update-in [:preamble] #(into (or % []) ["cljs/imul.js"])))
25212521

2522+
(:lite-mode opts)
2523+
(assoc-in [:closure-defines (str (comp/munge 'cljs.core/LITE_MODE))]
2524+
(:lite-mode opts))
2525+
25222526
(:target opts)
25232527
(assoc-in [:closure-defines (str (comp/munge 'cljs.core/*target*))]
25242528
(name (:target opts)))

0 commit comments

Comments
 (0)