Skip to content

Commit

Permalink
* type parsing wip
Browse files Browse the repository at this point in the history
  • Loading branch information
swannodette committed Mar 1, 2025
1 parent f3bb007 commit ef98670
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/clojure/cljs/externs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@
(into [] (butlast props))
(with-meta (last props) ty))))

(def token->kw
{Token/BANG :bang
Token/BLOCK :block
Token/PIPE :pipe
Token/STRINGLIT :string-lit})

(defn parse-texpr [^Node root]
(let [token (get token->kw (.getToken root))
children (.children root)]
(merge
{:type token}
(when-not (empty? children)
{:children (vec (map parse-texpr (.children root)))})
(when (= :string-lit token)
{:value (.getString root)}))))

(defn get-tag [^JSTypeExpression texpr]
(when-let [root (.getRoot texpr)]
(if (.isString root)
Expand Down

0 comments on commit ef98670

Please sign in to comment.