                  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*))
+             (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))
                  (ns-side-effects bound-vars aenv ast opts

;; -----------------------------------------------------------------------------
;; Eval

(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*))]
      (cb (*eval-fn*
            {:lang   :clj
             :source (with-out-str
                       (comp/emit (ana/analyze ana-env form nil opts)))})))))

(defn eval
  "Evaluate a single ClojureScript form. The parameters:

                 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)]
               (.append sb (with-out-str (comp/emit ast)))
               (if (= :ns (:op ast))
