Skip to content

Commit 8f38049

Browse files
committed
support hinting fns as ^js to avoid call
1 parent 7ef8fd9 commit 8f38049

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/clojure/cljs/compiler.cljc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,14 +1142,16 @@
11421142
opt-count? (and (= (:name info) 'cljs.core/count)
11431143
(boolean ('#{string array} first-arg-tag)))
11441144
ns (:ns info)
1145-
js? (or (= ns 'js) (= ns 'Math) (:foreign info)) ;; foreign - i.e. global / Node.js library
1145+
ftag (ana/infer-tag env f)
1146+
js? (or (= ns 'js) (= ns 'Math)
1147+
(ana/js-tag? ftag) (:foreign info)) ;; foreign - i.e. global / Node.js library
11461148
goog? (when ns
11471149
(or (= ns 'goog)
11481150
(when-let [ns-str (str ns)]
11491151
(= (get (string/split ns-str #"\.") 0 nil) "goog"))
11501152
(not (contains? (::ana/namespaces @env/*compiler*) ns))))
11511153

1152-
keyword? (or (= 'cljs.core/Keyword (ana/infer-tag env f))
1154+
keyword? (or (= 'cljs.core/Keyword ftag)
11531155
(let [f (ana/unwrap-quote f)]
11541156
(and (= (-> f :op) :const)
11551157
(keyword? (-> f :form)))))

0 commit comments

Comments
 (0)