Skip to content
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.

Commit

Permalink
Include "(*file*:*line*:*column*)" in warnings
Browse files Browse the repository at this point in the history
This patch makes use of the line, column vars from #52 to provide
position information for deprecated refer warnings.
  • Loading branch information
arrdem committed Feb 3, 2016
1 parent c1a7fec commit 09aefda
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/clj/clojure/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4148,7 +4148,8 @@
(throw (Exception. ":only/:refer value must be a sequential collection of symbols")))
(when (and (= op :all)
(deprecated? ns))
(.write *err* (str "Warning: referring vars from deprecated ns: " (name ns) "\n")))
(.write *err* (str "Warning: referring vars from deprecated ns: " (name ns)
" (" *file* ":" *line* ":" *column* ")\n")))
(doseq [sym to-do]
(when-not (exclude sym)
(let [v (nspublics sym)]
Expand All @@ -4159,7 +4160,8 @@
(str sym " does not exist")))))
(when (and (deprecated? v)
(not= op :all))
(.write *err* (str "Warning: referring deprecated var: " v "\n")))
(.write *err* (str "Warning: referring deprecated var: " v
" (" *file* ":" *line* ":" *column* ")\n")))
(. *ns* (refer (or (rename sym) sym) v)))))))

(defn ns-refers
Expand All @@ -4182,7 +4184,8 @@
[alias namespace-sym]
(let [other (the-ns namespace-sym)]
(when (deprecated? other)
(.write *err* (str "Warning: aliasing deprecated ns: " (name namespace-sym) "\n")))
(.write *err* (str "Warning: aliasing deprecated ns: " (name namespace-sym)
" (" *file* ":" *line* ":" *column* ")\n")))
(.addAlias *ns* alias other)))

(defn ns-aliases
Expand Down

0 comments on commit 09aefda

Please sign in to comment.