                                (map first %))))]
     [(second ns-decl) aliases]))
 
-(defn create-env [ns-info]
-  (let [ns (first ns-info)]
-    (atom {:namespaces {ns {:mappings {}
-                          :aliases (last ns-info)
-                          :ns ns}}})))
-
 (defn read-all-forms [reader]
   (let [eof (reify)]
     (loop [forms []]

          forms
          (recur (conj forms form)))))))

(defn string-ast [string]
     (binding [ana/macroexpand-1 ana.jvm/macroexpand-1
               ana/create-var    ana.jvm/create-var
               ana/parse         ana.jvm/parse
               ana/var?          var?]
       (try
         (let [[_ aliases] (parse-ns string)]
           (with-env (ana.jvm/global-env)
             (-> string
                 rts/indexing-push-back-reader
                 read-all-forms
                 (ana/analyze e)
                 (prewalk ana.si/source-info)
                 (assoc :alias-info aliases))))
         (catch Exception e
           (.printStackTrace e)
           {}))))

(ns refactor-nrepl.analyzer
  (:refer-clojure :exclude [macroexpand-1 read read-string])
  (:require [clojure.tools.analyzer :as ana]
            [clojure.tools.analyzer.ast :refer :all]
            [clojure.tools.analyzer.env :refer [with-env]]
            [clojure.tools.analyzer.jvm :as ana.jvm]
            [clojure.tools.analyzer.passes.jvm
             [box :refer [box]]
             [constant-lifter :refer [constant-lift]]
             [annotate-branch :refer [annotate-branch]]
             [annotate-loops :refer [annotate-loops]]
             [annotate-methods :refer [annotate-methods]]
             [annotate-class-id :refer [annotate-class-id]]
             [annotate-internal-name :refer [annotate-internal-name]]
             [fix-case-test :refer [fix-case-test]]
             [clear-locals :refer [clear-locals]]
             [classify-invoke :refer [classify-invoke]]
             [infer-tag :refer [infer-tag ensure-tag]]
             [annotate-tag :refer [annotate-tag]]
             [validate-loop-locals :refer [validate-loop-locals]]
             [analyze-host-expr :refer [analyze-host-expr]]]
            [clojure.tools.analyzer.passes
             [source-info :refer [source-info]]
             [cleanup :refer [cleanup]]
             [elide-meta :refer [elide-meta]]
             [warn-earmuff :refer [warn-earmuff]]
             [collect :refer [collect collect-closed-overs]]
             [add-binding-atom :refer [add-binding-atom]]
             [uniquify :refer [uniquify-locals]]]
            [clojure.tools.namespace.parse :refer [read-ns-decl]]
            [clojure.tools.reader :as r]
            [clojure.tools.reader.reader-types :as rts])
  (:import java.io.PushbackReader))

(def e (ana.jvm/empty-env))
