Skip to content

Commit 12be5ea

Browse files
committed
cleanup resolve-type, properly handle non-nullable types
1 parent f2f79e6 commit 12be5ea

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/main/clojure/cljs/compiler.cljc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -495,24 +495,21 @@
495495
(get mapped-types t) (get mapped-types t)
496496

497497
#?(:clj (.startsWith t "!")
498-
:cljs (gstring/startsWith t "!")) t
498+
:cljs (gstring/startsWith t "!"))
499+
(str "!" (resolve-type env (subs t 1)))
499500

500501
#?(:clj (.startsWith t "{")
501502
:cljs (gstring/startsWith t "{")) t
502503

503504
#?(:clj (.startsWith t "function")
504505
:cljs (gstring/startsWith t "function")) t
505506

507+
#?(:clj (.endsWith t "=")
508+
:cljs (gstring/endsWith t "="))
509+
(str (resolve-type env (subs t 0 (dec (count t)))) "=")
510+
506511
:else
507-
(let [optional? #?(:clj (.endsWith t "=")
508-
:cljs (gstring/endsWith t "="))
509-
t (if optional?
510-
(subs t 0 (dec (count t)))
511-
t)
512-
ret (munge (str (:name (ana/resolve-var env (symbol t)))))]
513-
(if optional?
514-
(str ret "=")
515-
ret))))
512+
(munge (str (:name (ana/resolve-var env (symbol t)))))))
516513

517514
(defn resolve-types [env ts]
518515
(let [ts (-> ts string/trim (subs 1 (dec (count ts))))

0 commit comments

Comments
 (0)