This repository was archived by the owner on Jan 23, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
test/swank/test_swank/commands Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 119119
120120; ;;; Compiler / Execution
121121
122- (def compiler-exception-location-re #"Exception:.*\( ([^:]+):([0-9]+)\) " )
122+ (def compiler-exception-location-re #"Exception:.*\( ([^:]+):([0-9]+)(:[0-9]+)? \) " )
123123(defn- guess-compiler-exception-location [#^Throwable t]
124124 (when (instance? clojure.lang.Compiler$CompilerException t)
125125 (let [[match file line] (re-find compiler-exception-location-re (str t))]
196196 (.getLineNumber f))
197197 (catch Exception e 1 )))
198198
199+ (defmacro compiler-exception [directory line ex]
200+ `(eval (if (>= (:minor *clojure-version*) 5 )
201+ '(clojure.lang.Compiler$CompilerException.
202+ ~directory ~line 0 ~ex)
203+ '(clojure.lang.Compiler$CompilerException.
204+ ~directory ~line ~ex))))
205+
199206(defslimefn compile-string-for-emacs [string buffer position directory debug]
200207 (let [start (System/nanoTime )
201208 line (line-at-position directory position)
202209 ret (with-emacs-package
203210 (when-not (= (name (ns-name *ns*)) *current-package*)
204- (throw (clojure.lang.Compiler$CompilerException.
211+ (throw (compiler-exception
205212 directory line
206213 (Exception. (str " No such namespace: "
207214 *current-package*)))))
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ list, Alan Dipert and MeikelBrandmeyer."
2222 (deftest guess-compiler-exception-location-test
2323 (is (= '(:location (:file " a.clj" ) (:line 1 ) nil )
2424 (guess-compiler-exception-location
25- ( clojure.lang.Compiler$CompilerException. " a.clj" 1 (Exception. " err" ))))))
25+ ( compiler-exception " a.clj" 1 (Exception. " err" ))))))
2626
2727 (deftest exception-location-test
2828 (is (= '(:location (:file " a.clj" ) (:line 1 ) nil )
2929 (exception-location
30- (clojure.lang.Compiler$CompilerException. " a.clj" 1 (Exception. " err" )))))))
30+ (compiler-exception " a.clj" 1 (Exception. " err" )))))))
You can’t perform that action at this time.
0 commit comments