Skip to content

Commit c3732db

Browse files
author
dnolen
committed
another micro-opt + remove gratuitous binding
1 parent b2a15b8 commit c3732db

File tree

4 files changed

+163
-144
lines changed

4 files changed

+163
-144
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,9 +1967,13 @@
19671967
:children children}
19681968
(when (some? name-var)
19691969
{:local name-var}))]
1970-
(let [variadic-methods (filter :variadic? methods)
1971-
variadic-params (count (:params (first variadic-methods)))
1972-
param-counts (map (comp count :params) methods)]
1970+
(let [variadic-methods (into []
1971+
(comp (filter :variadic?) (take 1))
1972+
methods)
1973+
variadic-params (if (pos? (count variadic-methods))
1974+
(count (:params (nth variadic-methods 0)))
1975+
0)
1976+
param-counts (into [] (map (comp count :params)) methods)]
19731977
(when (< 1 (count variadic-methods))
19741978
(warning :multiple-variadic-overloads env {:name name-var}))
19751979
(when (not (or (zero? variadic-params) (== variadic-params (+ 1 mfa))))
@@ -3581,7 +3585,7 @@
35813585
"Given a env, an analysis environment, and form, a ClojureScript form,
35823586
macroexpand the form once."
35833587
[env form]
3584-
(ensure (wrapping-errors env (macroexpand-1* env form))))
3588+
(wrapping-errors env (macroexpand-1* env form)))
35853589

35863590
(declare analyze-list)
35873591

@@ -3865,12 +3869,10 @@
38653869
(when env/*compiler*
38663870
(:options @env/*compiler*))))
38673871
([env form name opts]
3868-
(ensure
3869-
(wrapping-errors env
3870-
(binding [reader/*alias-map* (or reader/*alias-map* {})]
3871-
(if (analyzed? form)
3872-
(no-warn (analyze* env form name opts))
3873-
(analyze* env form name opts)))))))
3872+
(wrapping-errors env
3873+
(if (analyzed? form)
3874+
(no-warn (analyze* env form name opts))
3875+
(analyze* env form name opts)))))
38743876

38753877
(defn add-consts
38763878
"Given a compiler state and a map from fully qualified symbols to constant

0 commit comments

Comments
 (0)