Browse files

CLJS-697: top-level symbol reference doesn't get an automatically

inserted ns-name

Add another resolve-var . case, check the current ns
  • Loading branch information...
1 parent 8f7a199 commit d4bf88269e1d96468a19fd481f32628d4eafec9d @swannodette swannodette committed Nov 24, 2013
Showing with 12 additions and 7 deletions.
  1. +12 −7 src/clj/cljs/analyzer.clj
19 src/clj/cljs/analyzer.clj
@@ -331,11 +331,16 @@
lb (-> env :locals prefix)]
(if lb
{:name (symbol (str (:name lb) suffix))}
- (if-let [full-ns (get-in @env/*compiler* [::namespaces (-> env :ns :name) :imports prefix])]
- {:name (symbol (str full-ns) suffix)}
- (merge (get-in @env/*compiler* [::namespaces prefix :defs (symbol suffix)])
- {:name (if (= "" prefix) (symbol suffix) (symbol (str prefix) suffix))
- :ns prefix}))))
+ (let [cur-ns (-> env :ns :name)]
+ (if-let [full-ns (get-in @env/*compiler* [::namespaces cur-ns :imports prefix])]
+ {:name (symbol (str full-ns) suffix)}
+ (if-let [info (get-in @env/*compiler* [::namespaces cur-ns :defs prefix])]
+ (merge info
+ {:name (symbol (str cur-ns) (str sym))
+ :ns cur-ns})
+ (merge (get-in @env/*compiler* [::namespaces prefix :defs (symbol suffix)])
+ {:name (if (= "" prefix) (symbol suffix) (symbol (str prefix) suffix))
+ :ns prefix}))))))
(get-in @env/*compiler* [::namespaces (-> env :ns :name) :uses sym])
(let [full-ns (get-in @env/*compiler* [::namespaces (-> env :ns :name) :uses sym])]
@@ -354,8 +359,8 @@
(when confirm
(confirm env full-ns sym))
(merge (get-in @env/*compiler* [::namespaces full-ns :defs sym])
- {:name (symbol (str full-ns) (str sym))
- :ns full-ns})))))))
+ {:name (symbol (str full-ns) (str sym))
+ :ns full-ns})))))))
(defn resolve-existing-var [env sym]
(if-not (-> sym meta ::no-resolve)

0 comments on commit d4bf882

Please sign in to comment.