Skip to content

Commit bbac9ec

Browse files
committed
CLJS-2696: Large code size in Clojurescript 1.10.x for minimal code with optimizations advanced
Ensure printing fns don't pull in unnecessary code. Don't throw ex-info from default *eval*
1 parent fef574b commit bbac9ec

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,13 @@
187187
[]
188188
(set! *print-newline* false)
189189
(set-print-fn!
190-
(fn [& args]
191-
(.apply (.-log js/console) js/console (into-array args))))
190+
(fn []
191+
(let [xs (js-arguments)]
192+
(.apply (.-log js/console) js/console (garray/clone xs)))))
192193
(set-print-err-fn!
193-
(fn [& args]
194-
(.apply (.-error js/console) js/console (into-array args))))
194+
(fn []
195+
(let [xs (js-arguments)]
196+
(.apply (.-error js/console) js/console (garray/clone xs)))))
195197
nil)
196198

197199
(def
@@ -11503,11 +11505,15 @@ reduces them without incurring seq initialization"
1150311505
(let [system (.type js/Java "java.lang.System")]
1150411506
(set! *print-newline* false)
1150511507
(set-print-fn!
11506-
(fn [& args]
11507-
(.println (.-out system) (.join (into-array args) ""))))
11508+
(fn []
11509+
(let [xs (js-arguments)
11510+
s (.join (garray/clone xs) "")]
11511+
(.println (.-out system) s))))
1150811512
(set-print-err-fn!
11509-
(fn [& args]
11510-
(.println (.-error system) (.join (into-array args) "")))))))
11513+
(fn []
11514+
(let [xs (js-arguments)
11515+
s (.join (garray/clone xs) "")]
11516+
(.println (.-error system) s)))))))
1151111517

1151211518
(maybe-enable-print!)
1151311519

@@ -11517,7 +11523,7 @@ reduces them without incurring seq initialization"
1151711523
should be evaluated." :dynamic true}
1151811524
*eval*
1151911525
(fn [_]
11520-
(throw (ex-info "cljs.core/*eval* not bound" {}))))
11526+
(throw (js/Error. "cljs.core/*eval* not bound"))))
1152111527

1152211528
(defn eval
1152311529
"Evaluates the form data structure (not text!) and returns the result.

0 commit comments

Comments
 (0)