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 476
476
(emitln " throw " throw " ;" )))
477
477
478
478
(def base-types
479
- #{" boolean" " Boolean"
479
+ #{" null" " *"
480
+ " boolean" " Boolean"
480
481
" string" " String"
481
482
" number" " Number"
482
483
" array" " Array"
483
484
" object" " Object"
484
485
" RegExp"
485
486
" Date" })
486
487
488
+ (def mapped-types
489
+ {" nil" " null" })
490
+
487
491
(defn resolve-type [env ^String t]
488
492
(cond
489
493
(get base-types t) t
490
494
495
+ (get mapped-types t) (get mapped-types t)
496
+
491
497
#?(:clj (.startsWith t " !" )
492
498
:cljs (gstring/startsWith t " !" )) t
493
499
508
514
(str ret " =" )
509
515
ret))))
510
516
517
+ (defn type-munge [s]
518
+ (cond
519
+ (= " null" s) s
520
+ (= " *" s) s
521
+ :else (munge s)))
522
+
511
523
(defn resolve-types [env ts]
512
524
(let [ts (-> ts string/trim (subs 1 (dec (count ts))))
513
525
xs (string/split ts #"\| " )]
514
526
(str
515
527
" {"
516
528
(->> (map #(resolve-type env %) xs)
517
- (map munge)
529
+ (map type- munge)
518
530
(string/join " |" ))
519
531
" }" )))
520
532
You can’t perform that action at this time.
0 commit comments