Skip to content

Commit fca5265

Browse files
author
dnolen
committed
fix source so it works on macros
1 parent 3c3399f commit fca5265

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/clj/cljs/repl.clj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,10 +936,13 @@ itself (not its value) is returned. The reader macro #'x expands to (var x)."}})
936936
937937
Example: (source-fn 'filter)"
938938
[env x]
939-
(when-let [v (ana/resolve-var env x)]
939+
(when-let [v (ana-api/resolve env x)]
940940
(when-let [filepath (:file v)]
941-
(let [f (io/file filepath)]
942-
(when (.exists f)
941+
(let [f (io/file filepath)
942+
f (if (.exists f)
943+
f
944+
(io/resource filepath))]
945+
(when f
943946
(with-open [pbr (PushbackReader. (io/reader f))]
944947
(let [rdr (readers/source-logging-push-back-reader pbr)]
945948
(dotimes [_ (dec (:line v))] (readers/read-line rdr))

0 commit comments

Comments
 (0)