(defn parse-catch
[[_ etype ename & body :as form] env]
(when-not (valid-binding-symbol? ename)
(throw (ex-info (str "Bad binding form: " ename)
(merge {:sym ename
:form form}
(-source-info form env)))))
(let [env (dissoc env :in-try)
local {:op :binding
:env env
:form ename
:name ename
:local :catch}]
{:op :catch
:class (analyze-form etype (assoc env :locals {}))
:local local
:env env
:form form
:body (analyze-body body (assoc-in env [:locals ename] (dissoc-env local)))
:children [:class :local :body]}))