Permalink
Browse files

CLJS-692: cannot access properties on imported Google Closure

constructors

change resolve-var to check :imports for case where symbols have .'s in
them
  • Loading branch information...
1 parent a1514b1 commit 8f7a19983b449155175a5e77d6bd8a86d36d2f68 @swannodette swannodette committed Nov 24, 2013
Showing with 9 additions and 5 deletions.
  1. +5 −3 src/clj/cljs/analyzer.clj
  2. +4 −2 test/cljs/cljs/import_test.cljs
@@ -331,9 +331,11 @@
lb (-> env :locals prefix)]
(if lb
{:name (symbol (str (:name lb) suffix))}
- (merge (get-in @env/*compiler* [::namespaces prefix :defs (symbol suffix)])
- {:name (if (= "" prefix) (symbol suffix) (symbol (str prefix) suffix))
- :ns prefix})))
+ (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}))))
(get-in @env/*compiler* [::namespaces (-> env :ns :name) :uses sym])
(let [full-ns (get-in @env/*compiler* [::namespaces (-> env :ns :name) :uses sym])]
@@ -1,10 +1,12 @@
(ns cljs.import-test
(:import goog.math.Long
- [goog.math Vec2 Vec3]))
+ [goog.math Vec2 Vec3]
+ [goog.math Integer]))
(defn test-import []
(assert (fn? Long))
(assert (.equals (Long. 4 6) (.add (Long. 1 2) (Long. 3 4))))
(assert (= "12" (str (Long/fromInt 12))))
(assert (not (nil? (Vec2. 1 2))))
- (assert (not (nil? (Vec3. 1 2 3)))))
+ (assert (not (nil? (Vec3. 1 2 3))))
+ (assert (.equals (Integer.fromString "10") (goog.math.Integer.fromString "10"))))

0 comments on commit 8f7a199

Please sign in to comment.