File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 18
18
[com.google.javascript.rhino
19
19
Node Token JSTypeExpression]))
20
20
21
+ (def ^:dynamic *ignore-var* false )
21
22
(def ^:dynamic *source-file* nil )
22
23
23
24
; ; ------------------------------------------------------------------------------
78
79
lhs (cond-> (first (parse-extern-node (.getFirstChild node)))
79
80
ty (annotate ty))]
80
81
(if (> (.getChildCount node) 1 )
81
- (let [externs (parse-extern-node (.getChildAtIndex node 1 ))]
82
+ (let [externs
83
+ (binding [*ignore-var* true ]
84
+ (parse-extern-node (.getChildAtIndex node 1 )))]
82
85
(conj (map (fn [ext] (concat lhs ext)) externs)
83
86
lhs))
84
87
[lhs]))))
92
95
[lhs])))
93
96
94
97
(defmethod parse-extern-node Token /GETPROP [node]
95
- (let [props (map symbol (string/split (.getQualifiedName node) #"\. " ))]
96
- [(if-let [ty (get-type node)]
97
- (annotate props ty)
98
- props)]))
98
+ (when-not *ignore-var*
99
+ (let [props (map symbol (string/split (.getQualifiedName node) #"\. " ))]
100
+ [(if-let [ty (get-type node)]
101
+ (annotate props ty)
102
+ props)])))
99
103
100
104
(defmethod parse-extern-node Token /OBJECTLIT [node]
101
105
(when (> (.getChildCount node) 0 )
Original file line number Diff line number Diff line change 1
1
(ns cljs.externs-parsing-test
2
- (:require [cljs.externs :as externs]
2
+ (:require [cljs.closure :as closure]
3
+ [cljs.externs :as externs]
4
+ [clojure.java.io :as io]
3
5
[clojure.test :as test :refer [deftest is]]))
6
+
7
+ (deftest cljs-3121
8
+ (let [externs (externs/parse-externs
9
+ (closure/js-source-file " goog/string/string.js"
10
+ (io/input-stream (io/resource " goog/string/string.js" ))))]
11
+ (is (every?
12
+ (fn [xs]
13
+ (= (count (distinct xs))
14
+ (count xs)))
15
+ externs))))
You can’t perform that action at this time.
0 commit comments