File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 476476 (emitln " throw " throw " ;" )))
477477
478478(def base-types
479- #{" boolean" " Boolean"
479+ #{" null" " *"
480+ " boolean" " Boolean"
480481 " string" " String"
481482 " number" " Number"
482483 " array" " Array"
483484 " object" " Object"
484485 " RegExp"
485486 " Date" })
486487
488+ (def mapped-types
489+ {" nil" " null" })
490+
487491(defn resolve-type [env ^String t]
488492 (cond
489493 (get base-types t) t
490494
495+ (get mapped-types t) (get mapped-types t)
496+
491497 #?(:clj (.startsWith t " !" )
492498 :cljs (gstring/startsWith t " !" )) t
493499
508514 (str ret " =" )
509515 ret))))
510516
517+ (defn type-munge [s]
518+ (cond
519+ (= " null" s) s
520+ (= " *" s) s
521+ :else (munge s)))
522+
511523(defn resolve-types [env ts]
512524 (let [ts (-> ts string/trim (subs 1 (dec (count ts))))
513525 xs (string/split ts #"\| " )]
514526 (str
515527 " {"
516528 (->> (map #(resolve-type env %) xs)
517- (map munge)
529+ (map type- munge)
518530 (string/join " |" ))
519531 " }" )))
520532
You can’t perform that action at this time.
0 commit comments