 ;; You must not remove this notice, or any other, from this software.
 
 (ns cljs.repl.rhino
+  (:refer-clojure :exclude [load-file])
   (:require [clojure.string :as string]
             [clojure.java.io :as io]
             [cljs.compiler :as comp]
+            [cljs.closure :as closure]
             [cljs.analyzer :as ana]
             [cljs.repl :as repl]
             [cljs.util :as util])

    (catch Throwable ex (println (.getMessage ex)))))

(defn rhino-setup [repl-env opts]
  (let [env   (ana/empty-env)
        scope (:scope repl-env)]
    (ScriptableObject/putProperty scope "__repl_opts"
      (Context/javaToJS opts scope))
    (repl/load-file repl-env "cljs/core.cljs" opts)
    (ScriptableObject/putProperty scope
      "out" (Context/javaToJS *out* scope))
    (binding [ana/*cljs-ns* 'cljs.core]
      (repl/evaluate-form repl-env env "<cljs repl>"
        '(do
           (set! (.-isProvided_ js/goog) (fn [_] false))
           (set! *print-fn* (fn [x] (.write js/out x))))))))

(defrecord RhinoEnv []
  repl/IReplEnvOptions

       :value (.toString ex)
       :stacktrace (stacktrace ex)})))

(defn load-file
  "Load a JavaScript. This is needed to load JavaScript files before the Rhino
   environment is bootstrapped. After bootstrapping load-javascript will be
   used."
  [repl-env opts src]
  (let [goog-path (io/file (util/output-directory opts) "goog" src)]
    (rhino-eval repl-env (.getPath goog-path) 1 (slurp goog-path))))

(defn load-javascript [repl-env ns url]
  (try
