        :else
        (if (and ana/*cljs-static-fns* (= (:op f) :var))
          (let [fprop (str ".cljs$core$IFn$_invoke$arity$" (count args))]
-           (emits "(" f fprop " ? " f fprop "(" (comma-sep args) ") : " f ".call(" (comma-sep (cons "null" args)) "))"))
-         (emits f ".call(" (comma-sep (cons "null" args)) ")"))))))
+           (emits "(func() { if " f fprop " { return " f fprop "(" (comma-sep args) ") } else { return " f ".(" (comma-sep (cons "null" args)) ")}})()"))
+         (emits f ".(" (comma-sep (cons "null" args)) ")"))))))
 
 (defmethod emit* :new
   [{:keys [ctor args env]}]

      (doseq [{:keys [init] :as binding} bindings]
        (emits "var ")
        (emit binding) ; Binding will be treated as a var
        (emits " = " init ";"))
      (when is-loop (emitln "while(true){"))
      (emits expr)
      (when is-loop
        (emitln "break;")
        (emitln "}")))
    (when (= :expr context) (emits "})()"))))


              ms (sort-by #(-> % second :params count) (seq mmap))]
          (when (= :return (:context env))
            (emits "return "))
          (emitln "(func() {")
          (emitln "var " mname " = nil;")
          (doseq [[n meth] ms]
            (emits "var " n " = ")
            (if (:variadic meth)
              (emit-variadic-fn-method meth)
              (emit-fn-method meth))
            (emitln))
            (emitln mname " = func(" (comma-sep (if variadic
                                                  (concat (butlast maxparams) ['var_args])
                                                  maxparams)) "){")
          (when variadic
            (emits "var ")
            (emit (last maxparams))
            (emitln " = var_args"))
          (emitln "switch(len(arguments)){")
          (doseq [[n meth] ms]
            (if (:variadic meth)
              (do (emitln "default:")
                  (emitln "return " n ".cljs$core$IFn$_invoke$arity$variadic("
                          (comma-sep (butlast maxparams))
                          (when (> (count maxparams) 1) ", ")
                          "cljs.core.array_seq(arguments, " max-fixed-arity "))"))
              (let [pcnt (count (:params meth))]
                (emitln "case " pcnt ":")
                (emitln "return " n "(this" (if (zero? pcnt) nil
                                                (list "," (comma-sep (take pcnt maxparams)))) ")"))))
          (emitln "}")
          (emitln "panic(js.Error{'Invalid arity: ' + len(arguments)})")
          (emitln "}")
          (when variadic
            (emitln mname ".cljs$lang$maxFixedArity = " max-fixed-arity)
            (emitln mname ".cljs$lang$applyTo = " (some #(let [[n m] %] (when (:variadic m) n)) ms) ".cljs$lang$applyTo"))
          (when has-name?
            (doseq [[n meth] ms]
              (let [c (count (:params meth))]
                (if (:variadic meth)
                  (emitln mname ".cljs$core$IFn$_invoke$arity$variadic = " n ".cljs$core$IFn$_invoke$arity$variadic")
                  (emitln mname ".cljs$core$IFn$_invoke$arity$" c " = " n)))))
          (emitln "return " mname)
          (emitln "})()")))
      (when loop-locals
        (emitln "})(" (comma-sep loop-locals) "))")))))

(defmethod emit* :do
  [{:keys [statements ret env]}]
