We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 70a5cdf commit 3cfc0b4Copy full SHA for 3cfc0b4
src/main/clojure/cljs/core.cljc
@@ -618,8 +618,11 @@
618
"defs name to have the root value of init iff the named var has no root value,
619
else init is unevaluated"
620
[x init]
621
- `(when-not (exists? ~x)
622
- (def ~x ~init)))
+ (core/let [qualified (if (namespace x)
+ x
623
+ (symbol (core/str (core/-> &env :ns :name)) (name x)))]
624
+ `(when-not (exists? ~qualified)
625
+ (def ~x ~init))))
626
627
(core/defn destructure [bindings]
628
(core/let [bents (partition 2 bindings)
src/test/cljs/cljs/core_test.cljs
@@ -1874,3 +1874,7 @@
1874
(for [e s :when (and (sequential? e) (every? (fn [x] x) e))]
1875
e))
1876
[[]]))))
1877
+
1878
+(deftest test-cljs-3333
1879
+ (defonce not-native 17) ;; Intentionally matching a core name
1880
+ (is (== 17 not-native)))
0 commit comments