Browse files

Merge branch 'master' into source-map

  • Loading branch information...
2 parents 3e5cbdb + ab6325d commit 9326c01bfcd1b2ed8c8f38ede2d1c247ee42164e @swannodette swannodette committed Mar 14, 2013
Showing with 16 additions and 13 deletions.
  1. +13 −10 src/clj/cljs/compiler.clj
  2. +1 −1 src/clj/cljs/core.clj
  3. +2 −2 src/clj/cljs/repl/rhino.clj
View
23 src/clj/cljs/compiler.clj
@@ -859,19 +859,22 @@
Returns a map containing {:ns .. :provides .. :requires .. :file ..}.
If the file was not compiled returns only {:file ...}"
([src]
- (let [dest (rename-to-js src)]
- (compile-file src dest nil)))
+ (let [dest (rename-to-js src)]
+ (compile-file src dest nil)))
([src dest]
- (compile-file src dest nil))
+ (compile-file src dest nil))
([src dest opts]
- (let [src-file (io/file src)
+ (let [src-file (io/file src)
dest-file (io/file dest)]
- (if (.exists src-file)
- (if (or (requires-compilation? src-file dest-file) (:source-map opts))
- (do (mkdirs dest-file)
- (compile-file* src-file dest-file opts))
- (parse-ns src-file dest-file opts))
- (throw (java.io.FileNotFoundException. (str "The file " src " does not exist.")))))))
+ (if (.exists src-file)
+ (try
+ (if (or (requires-compilation? src-file dest-file) (:source-map opts))
+ (do (mkdirs dest-file)
+ (compile-file* src-file dest-file opts))
+ (parse-ns src-file dest-file opts))
+ (catch Exception e
+ (throw (ex-info (str "failed compiling file:" src) {:file src} e))))
+ (throw (java.io.FileNotFoundException. (str "The file " src " does not exist.")))))))
(comment
;; flex compile-file
View
2 src/clj/cljs/core.clj
@@ -1152,7 +1152,7 @@
(conj (meta mm-name) m)
m)]
(when (= (count options) 1)
- (throw "The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value)"))
+ (throw (Exception. "The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value)")))
(let [options (apply hash-map options)
default (core/get options :default :default)]
(check-valid-options options :default :hierarchy)
View
4 src/clj/cljs/repl/rhino.clj
@@ -102,11 +102,11 @@
'(ns cljs.user))
(ScriptableObject/putProperty scope
"out"
- (Context/javaToJS System/out scope))
+ (Context/javaToJS *out* scope))
(repl/evaluate-form repl-env
env
"<cljs repl>"
- '(set! *print-fn* (fn [x] (.print js/out x))))))
+ '(set! *print-fn* (fn [x] (.write js/out x))))))
(defrecord RhinoEnv [loaded-libs]
repl/IJavaScriptEnv

0 comments on commit 9326c01

Please sign in to comment.