Permalink
Browse files

* src/clj/cljs/closure.clj: only do static fn optimizations during ad…

…vanced compilation
  • Loading branch information...
1 parent e4c6ae4 commit 3c170db8fdeeb0f093efb4b5506e27cd5f3adb12 David Nolen committed Apr 15, 2012
Showing with 7 additions and 2 deletions.
  1. +4 −1 src/clj/cljs/closure.clj
  2. +3 −1 src/clj/cljs/compiler.clj
View
5 src/clj/cljs/closure.clj
@@ -869,7 +869,10 @@
:ups-libs (:libs ups-deps)
:ups-foreign-libs (:foreign-libs ups-deps)
:ups-externs (:externs ups-deps))
- compiled (-compile source all-opts)
+ compiled (binding [comp/*cljs-static-fns*
+ (or (and (= (opts :optimizations) :advanced))
+ comp/*cljs-static-fns*)]
+ (-compile source all-opts))
compiled (concat
(if (coll? compiled) compiled [compiled])
(when (= :nodejs (:target all-opts))
View
4 src/clj/cljs/compiler.clj
@@ -44,6 +44,7 @@
(def ^:dynamic *cljs-warn-on-dynamic* true)
(def ^:dynamic *cljs-warn-on-fn-var* true)
(def ^:dynamic *unchecked-if* (atom false))
+(def ^:dynamic *cljs-static-fns* false)
(def ^:dynamic *position* nil)
(defmacro ^:private debug-prn
@@ -642,7 +643,8 @@
(defmethod emit :invoke
[{:keys [f args env]}]
- (let [fn? (and (not (-> f :info :dynamic))
+ (let [fn? (and *cljs-static-fns*
+ (not (-> f :info :dynamic))
(-> f :info :fn-var))
js? (= (-> f :info :ns) 'js)
f (if fn?

0 comments on commit 3c170db

Please sign in to comment.