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 842
842
(or (js-tag (next pre) tag-type externs' top)
843
843
(js-tag (into '[prototype] (next pre)) tag-type (get top tag) top)))))))
844
844
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
+
845
852
(defn resolve-var
846
853
" Resolve a var. Accepts a side-effecting confirm fn for producing
847
854
warnings about unresolved vars."
887
894
{:name (symbol (str full-ns) (str (name sym)))
888
895
:ns full-ns}))
889
896
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)
894
898
(let [idx (.indexOf s " ." )
895
899
prefix (symbol (subs s 0 idx))
896
900
suffix (subs s (inc idx))]
3318
3322
(instance? File x) (.getAbsolutePath ^File x)
3319
3323
:default (str x))))
3320
3324
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))))
3323
3330
3324
3331
#?(:clj
3325
3332
(defn forms-seq*
Original file line number Diff line number Diff line change 1335
1335
(is (= ::not-found (nth (range 2 ) -2 ::not-found )))
1336
1336
(is (= ::not-found (nth (range 2 1 0 ) -2 ::not-found ))))
1337
1337
1338
+ (deftest test-cljs-2109
1339
+ (testing " Syntax quoted dotted symbol without namespace should resolve to itself"
1340
+ (is (= 'clojure.core `clojure.core))))
1341
+
1338
1342
(comment
1339
1343
; ; ObjMap
1340
1344
; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments