-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,17 +237,15 @@ | |
Dialect is either :clj or :cljs." | ||
([path] | ||
(with-open [file-reader (FileReader. path)] | ||
(if-let [ns-form (parse/read-ns-decl (readers/indexing-push-back-reader | ||
(when-let [ns-form (parse/read-ns-decl (readers/indexing-push-back-reader | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
benedekfazekas
Author
Member
|
||
(PushbackReader. file-reader)))] | ||
(with-meta ns-form (extract-ns-meta (slurp path))) | ||
(throw (IllegalStateException. (str "No ns form at " path)))))) | ||
(with-meta ns-form (extract-ns-meta (slurp path)))))) | ||
([dialect path] | ||
(with-open [file-reader (FileReader. path)] | ||
(if-let [ns-form (parse/read-ns-decl (readers/indexing-push-back-reader | ||
(when-let [ns-form (parse/read-ns-decl (readers/indexing-push-back-reader | ||
(PushbackReader. file-reader)) | ||
{:read-cond :allow :features #{dialect}})] | ||
(with-meta ns-form (extract-ns-meta (slurp path))) | ||
(throw (IllegalStateException. (str "No ns form at " path))))))) | ||
(with-meta ns-form (extract-ns-meta (slurp path))))))) | ||
|
||
(defn path->namespace | ||
"Read the ns form found at PATH and return the namespace object for | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,9 @@ | |
(mapcat identity) | ||
(apply hash-map))) | ||
|
||
(defn- cache-contains? [f lang] | ||
(-> @cache (get (.getAbsolutePath f)) (contains? lang))) | ||
|
||
(defn- get-cached-libspec [f lang] | ||
(when-let [[ts v] (get-in @cache [(.getAbsolutePath f) lang])] | ||
(when (= ts (.lastModified f)) | ||
|
@@ -36,8 +39,8 @@ | |
libspecs)) | ||
|
||
(defn- get-libspec-from-file-with-caching [lang f] | ||
(if-let [v (get-cached-libspec f lang)] | ||
v | ||
(if (cache-contains? f lang) | ||
This comment has been minimized.
Sorry, something went wrong.
expez
Member
|
||
(get-cached-libspec f lang) | ||
(put-cached-libspec f lang))) | ||
|
||
(defn namespace-aliases | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
;; empty file | ||
;; to test that empty, no ns form clj files don't break refactor-nrepl indexers |
Have you verified (by inspection) that all callers of these functions are able to handle a return value of
nil
?