We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f3bb007 commit ef98670Copy full SHA for ef98670
src/main/clojure/cljs/externs.clj
@@ -38,6 +38,22 @@
38
(into [] (butlast props))
39
(with-meta (last props) ty))))
40
41
+(def token->kw
42
+ {Token/BANG :bang
43
+ Token/BLOCK :block
44
+ Token/PIPE :pipe
45
+ Token/STRINGLIT :string-lit})
46
+
47
+(defn parse-texpr [^Node root]
48
+ (let [token (get token->kw (.getToken root))
49
+ children (.children root)]
50
+ (merge
51
+ {:type token}
52
+ (when-not (empty? children)
53
+ {:children (vec (map parse-texpr (.children root)))})
54
+ (when (= :string-lit token)
55
+ {:value (.getString root)}))))
56
57
(defn get-tag [^JSTypeExpression texpr]
58
(when-let [root (.getRoot texpr)]
59
(if (.isString root)
0 commit comments