File tree Expand file tree Collapse file tree 3 files changed +29
-10
lines changed Expand file tree Collapse file tree 3 files changed +29
-10
lines changed Original file line number Diff line number Diff line change 4343 (some (set symbols-in-file) (map str (vals rename))))
4444
4545(defn- libspec-in-use?
46- [{:keys [refer] :as libspec} symbols-in-file current-ns]
47- (when (or (if (= refer :all )
48- (some (partial libspec-in-use-with-refer-all? libspec current-ns)
49- symbols-in-file)
50- (some (partial libspec-in-use-without-refer-all? libspec)
51- symbols-in-file))
52- (libspec-in-use-with-rename? libspec symbols-in-file))
53- libspec))
46+ [{libspec-refer :refer
47+ libspec-ns :ns
48+ libspec-as :as
49+ :as libspec} symbols-in-file current-ns]
50+ (let [refer-all? (= libspec-refer :all )
51+ libspec-as-str (str libspec-as)
52+ symbols-in-file (cond-> symbols-in-file
53+ (and (string? libspec-ns)
54+ (not refer-all?)
55+ libspec-as
56+ (contains? (set symbols-in-file) libspec-as-str))
57+ (conj (str (symbol libspec-ns libspec-as-str))))]
58+ (when (or (if refer-all?
59+ (some (partial libspec-in-use-with-refer-all? libspec current-ns)
60+ symbols-in-file)
61+ (some (partial libspec-in-use-without-refer-all? libspec)
62+ symbols-in-file))
63+ (libspec-in-use-with-rename? libspec symbols-in-file))
64+ libspec)))
5465
5566(defn- referred-symbol-in-use?
5667 [symbol-ns used-syms sym]
Original file line number Diff line number Diff line change 1010 [" react" :as react]
1111 [" underscore$default" :as underscore]
1212 [" react-UNUSED" :as react-unused]
13- [" underscore-UNUSEd$default" :as underscore-unused])
13+ [" underscore-UNUSED$default" :as underscore-unused]
14+ [" @react-native-async-storage/async-storage" :as AsyncStorage])
1415 (:require-macros [cljs.test :refer [testing]]
1516 [cljs.analyzer.macros :as am]
1617 cljs.analyzer.api)
2930 []
3031 (react/foo underscore/bar))
3132
33+ ; ; https://github.com/clojure-emacs/clj-refactor.el/issues/529
34+ (defn use-as
35+ " Uses an `:as` name as an object in itself"
36+ []
37+ (.getItem AsyncStorage " foo" ))
38+
3239(deftest tt
3340 (testing " whatever"
3441 (is (= 1 1 ))))
Original file line number Diff line number Diff line change 11(ns cljsns
2- (:require [" react" :as react]
2+ (:require [" @react-native-async-storage/async-storage" :as AsyncStorage]
3+ [" react" :as react]
34 [" underscore$default" :as underscore]
45 [cljs.pprint :as pprint]
56 [cljs.test :refer-macros [deftest is]]
You can’t perform that action at this time.
0 commit comments