(defn analyze-method-impls
[[method [this & params :as args] & body :as form] env]
(when-let [error-msg (cond
(not (symbol? method))
(str "Method method must be a symbol, had: " (class method))
(not (vector? args))
(str "Parameter listing should be a vector, had: " (class args))
(not (first args))
(str"Must supply at least one argument for 'this' in: " method))]
(throw (ex-info error-msg
(merge {:form form
:in (:this env)
:method method
:args args}
(-source-info form env)))))
(let [meth (cons (vec params) body) ;; this is an implicit arg
this-expr {:name this
:env env
:form this
:op :binding
:o-tag (:this env)
:tag (:this env)
:local :this}
env (assoc-in (dissoc env :this) [:locals this] (dissoc-env this-expr))
method-expr (analyze-fn-method meth env)]
(assoc (dissoc method-expr :variadic?)
:op :method
:form form
:this this-expr
:name (symbol (name method))
:children (into [:this] (:children method-expr)))))