@@ -8,14 +8,15 @@ let rec remove_option ~(label : Asttypes.Noloc.arg_label)
88 | Tconstr (Path. Pident id, [t], _), Optional lbl when Ident. name id = " option"
99 ->
1010 Some (lbl, t)
11- | Tconstr (Pdot (Path. Pident name_space, id, _), [t], _), Optional lbl
12- when Ident. name name_space = " FB" && id = " option" ->
13- Some (lbl, t)
1411 | Tlink t , _ -> t |> remove_option ~label
1512 | _ -> None
1613
1714let rec path_to_list path =
1815 match path with
16+ | Path. Pident id when String. starts_with (Ident. name id) ~prefix: " Stdlib_" ->
17+ let name = Ident. name id in
18+ let without_stdlib_prefix = String. sub name 7 (String. length name - 7 ) in
19+ [without_stdlib_prefix; " Stdlib" ]
1920 | Path. Pident id -> [id |> Ident. name]
2021 | Path. Pdot (p , s , _ ) -> s :: (p |> path_to_list)
2122 | Path. Papply _ -> []
@@ -75,11 +76,10 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
7576 }
7677 in
7778 match (path |> path_to_list |> List. rev, params_translation) with
78- | ([" FB" ; " bool" ] | [" bool" ]), [] -> {dependencies = [] ; type_ = boolean_t}
79- | ([" FB" ; " int" ] | [" int" ]), [] -> {dependencies = [] ; type_ = number_t}
80- | ([" FB" ; " float" ] | [" float" ]), [] -> {dependencies = [] ; type_ = number_t}
81- | ( ( [" FB" ; " string" ]
82- | [" string" ]
79+ | [" bool" ], [] -> {dependencies = [] ; type_ = boolean_t}
80+ | [" int" ], [] -> {dependencies = [] ; type_ = number_t}
81+ | [" float" ], [] -> {dependencies = [] ; type_ = number_t}
82+ | ( ( [" string" ]
8383 | [" String" ; " t" ]
8484 | [" Stdlib" ; " String" ; " t" ]
8585 | [" Js" ; (" String" | " String2" ); " t" ] ),
@@ -118,9 +118,8 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
118118 }
119119 | ([" Js" ; " Re" ; " t" ] | [" RegExp" ; " t" ] | [" Stdlib" ; " RegExp" ; " t" ]), [] ->
120120 {dependencies = [] ; type_ = regexp_t}
121- | ([" FB" ; " unit" ] | [" unit" ]), [] -> {dependencies = [] ; type_ = unit_t}
122- | ( ([" FB" ; " array" ] | [" array" ] | [" Js" ; (" Array" | " Array2" ); " t" ]),
123- [param_translation] ) ->
121+ | [" unit" ], [] -> {dependencies = [] ; type_ = unit_t}
122+ | ([" array" ] | [" Js" ; (" Array" | "Array2" ); "t" ]), [param_translation] ->
124123 {param_translation with type_ = Array (param_translation.type_, Mutable )}
125124 | [" ImmutableArray" ; " t" ], [param_translation] ->
126125 {param_translation with type_ = Array (param_translation.type_, Immutable )}
@@ -220,7 +219,7 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
220219 | [" Jsx" ; " element" ] ),
221220 [] ) ->
222221 {dependencies = [] ; type_ = EmitType. type_react_element}
223- | ([ " FB " ; " option" ] | [ " option " ]) , [param_translation] ->
222+ | [ " option" ], [param_translation] ->
224223 {param_translation with type_ = Option param_translation.type_}
225224 | ( ( [" Js" ; " Undefined" ; " t" ]
226225 | [" Undefined" ; " t" ]
@@ -253,6 +252,7 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
253252 | ( ([" Js" ; " Dict" ; " t" ] | [" Dict" ; " t" ] | [" dict" ] | [" Stdlib" ; " Dict" ; " t" ]),
254253 [param_translation] ) ->
255254 {param_translation with type_ = Dict param_translation.type_}
255+ | [" Stdlib" ; " JSON" ; " t" ], [] -> {dependencies = [] ; type_ = unknown}
256256 | _ -> default_case ()
257257
258258type process_variant = {
0 commit comments