                                  (reduce #(assoc %1 %2 (ns-resolve ns (symbol (name %2)))) m refer))
                                {} require-macros)]
 
-    (swap! namespaces assoc-in [ns-name]
+    (swap! *env* assoc-in [:namespaces ns-name]
            {:ns             ns-name
             :mappings       (merge core-mappings require-mappings)
             :aliases        (merge imports require-aliases)

    (ana/-analyze-form form env)))

(defn parse-type
  [op [_ name fields pmasks :as form] {:keys [ns namespaces] :as env}]
  (let [fields-expr (mapv (fn [name]
                            {:env     env
                             :form    name


(def ^:dynamic *ns* 'cljs.user)

(defn global-env []
  (atom '{:namespaces {cljs.user {:mappings       {}
                                  :aliases        {}
                                  :macro-mappings {}
                                  :macro-aliases  {}
                                  :ns             cljs.user}
                       cljs.core {:mappings       {}
                                  :aliases        {}
                                  :macro-mappings {}
                                  :macro-aliases  {}
                                  :ns             cljs.core}}}))

(defn empty-env
  "Returns an empty env map"
  []
  {:context    :statement
   :locals     {}
   :ns         *ns*})

(defn desugar-host-expr [[op & expr :as form]]
  (if (symbol? op)
