(defn -analyze-host-expr
[target-type m-or-f target-expr class env]
(let [target-class (-> target-expr :tag)
[field method] (if class
[(maybe-static-field (list '. class m-or-f))
(maybe-static-method (list '. class m-or-f))]
(when target-class
[(maybe-instance-field target-expr target-class m-or-f)
(maybe-instance-method target-expr target-class m-or-f)]))]
(cond
(not (or class target-class))
{:op :host-interop
:target target-expr
:m-or-f m-or-f
:assignable? true
:children [:target]}
method
method
field
field
class
(throw (ex-info (str "Cannot find field or no-arg method call "
m-or-f " for class " class)
(merge {:class class
:m-or-f m-or-f}
(source-info env))))
target-class
{:op :host-interop
:target (dissoc target-expr :tag :validated?)
:m-or-f m-or-f
:assignable? true
:children [:target]}
:else
(when (:literal? target-expr)
(throw (ex-info (str "Cannot find field or no-arg method call "
m-or-f " for class " target-class)
(merge {:instance (dissoc target-expr :env)
:m-or-f m-or-f}
(source-info env))))))))