File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 842842 (or (js-tag (next pre) tag-type externs' top)
843843 (js-tag (into '[prototype] (next pre)) tag-type (get top tag) top)))))))
844844
845+ (defn dotted-symbol? [sym]
846+ (let [s (str sym)]
847+ #?(:clj (and (.contains s " ." )
848+ (not (.contains s " .." )))
849+ :cljs (and ^boolean (goog.string/contains s " ." )
850+ (not ^boolean (goog.string/contains s " .." ))))))
851+
845852(defn resolve-var
846853 " Resolve a var. Accepts a side-effecting confirm fn for producing
847854 warnings about unresolved vars."
887894 {:name (symbol (str full-ns) (str (name sym)))
888895 :ns full-ns}))
889896
890- #?(:clj (and (.contains s " ." )
891- (not (.contains s " .." )))
892- :cljs (and ^boolean (goog.string/contains s " ." )
893- (not ^boolean (goog.string/contains s " .." ))))
897+ (dotted-symbol? sym)
894898 (let [idx (.indexOf s " ." )
895899 prefix (symbol (subs s 0 idx))
896900 suffix (subs s (inc idx))]
33183322 (instance? File x) (.getAbsolutePath ^File x)
33193323 :default (str x))))
33203324
3321- (defn resolve-symbol [s]
3322- (:name (resolve-var (assoc @env/*compiler* :ns (get-namespace *cljs-ns*)) s)))
3325+ (defn resolve-symbol [sym]
3326+ (if (and (not (namespace sym))
3327+ (dotted-symbol? sym))
3328+ sym
3329+ (:name (resolve-var (assoc @env/*compiler* :ns (get-namespace *cljs-ns*)) sym))))
33233330
33243331#?(:clj
33253332 (defn forms-seq*
Original file line number Diff line number Diff line change 13351335 (is (= ::not-found (nth (range 2 ) -2 ::not-found )))
13361336 (is (= ::not-found (nth (range 2 1 0 ) -2 ::not-found ))))
13371337
1338+ (deftest test-cljs-2109
1339+ (testing " Syntax quoted dotted symbol without namespace should resolve to itself"
1340+ (is (= 'clojure.core `clojure.core))))
1341+
13381342(comment
13391343 ; ; ObjMap
13401344 ; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments