 ;; -----------------------------------------------------------------------------
 ;; Eval
 
+;; TODO: ns form handling, source mapping
+
 (defn eval* [bound-vars form opts cb]
   (binding [env/*compiler*   (:*compiler* bound-vars)
             *eval-fn*        (:*eval-fn* bound-vars)
             ana/*cljs-ns*    (:*cljs-ns* bound-vars)
             *ns*             (:*ns* bound-vars)
             r/*data-readers* (:*data-readers* bound-vars)]
-    (let [ana-env (assoc (ana/empty-env)
-                    :ns (ana/get-namespace ana/*cljs-ns*))]
+    (let [aenv (ana/empty-env)
+          aenv (cond-> (assoc aenv :ns (ana/get-namespace ana/*cljs-ns*))
+                 (:context opts) (assoc :context (:context opts))
+                 (:def-emits-var opts) (assoc :def-emits-var true))]
       (cb (*eval-fn*
             {:lang   :clj
              :source (with-out-str
-                       (comp/emit (ana/analyze ana-env form nil opts)))})))))
+                       (comp/emit (ana/analyze aenv form nil opts)))})))))
 
 (defn eval
   "Evaluate a single ClojureScript form. The parameters:

                 r/*data-readers* (:*data-readers* bound-vars)]
         (let [form (r/read {:eof eof :read-cond :allow :features #{:cljs}} rdr)]
           (if-not (identical? eof form)
             (let [aenv (assoc aenv :ns (ana/get-namespace ana/*cljs-ns*))
                   ast  (ana/analyze aenv form)]
               (if (= :ns (:op ast))
                 (ns-side-effects bound-vars aenv ast opts

                 comp/*source-map-data* (:*sm-data* bound-vars)]
         (let [form (r/read {:eof eof :read-cond :allow :features #{:cljs}} rdr)]
           (if-not (identical? eof form)
             (let [aenv (cond-> (assoc aenv :ns (ana/get-namespace ana/*cljs-ns*))
                          (:context opts) (assoc :context (:context opts))
                          (:def-emits-var opts) (assoc :def-emits-var true))
                   ast  (ana/analyze aenv form)]
               (if (= :ns (:op ast))
                 (do
