@@ -8,14 +8,15 @@ let rec remove_option ~(label : Asttypes.Noloc.arg_label)
8
8
| Tconstr (Path. Pident id, [t], _), Optional lbl when Ident. name id = " option"
9
9
->
10
10
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)
14
11
| Tlink t , _ -> t |> remove_option ~label
15
12
| _ -> None
16
13
17
14
let rec path_to_list path =
18
15
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" ]
19
20
| Path. Pident id -> [id |> Ident. name]
20
21
| Path. Pdot (p , s , _ ) -> s :: (p |> path_to_list)
21
22
| Path. Papply _ -> []
@@ -75,11 +76,10 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
75
76
}
76
77
in
77
78
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" ]
83
83
| [" String" ; " t" ]
84
84
| [" Stdlib" ; " String" ; " t" ]
85
85
| [" Js" ; (" String" | " String2" ); " t" ] ),
@@ -118,9 +118,8 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
118
118
}
119
119
| ([" Js" ; " Re" ; " t" ] | [" RegExp" ; " t" ] | [" Stdlib" ; " RegExp" ; " t" ]), [] ->
120
120
{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] ->
124
123
{param_translation with type_ = Array (param_translation.type_, Mutable )}
125
124
| [" ImmutableArray" ; " t" ], [param_translation] ->
126
125
{param_translation with type_ = Array (param_translation.type_, Immutable )}
@@ -220,7 +219,7 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
220
219
| [" Jsx" ; " element" ] ),
221
220
[] ) ->
222
221
{dependencies = [] ; type_ = EmitType. type_react_element}
223
- | ([ " FB " ; " option" ] | [ " option " ]) , [param_translation] ->
222
+ | [ " option" ], [param_translation] ->
224
223
{param_translation with type_ = Option param_translation.type_}
225
224
| ( ( [" Js" ; " Undefined" ; " t" ]
226
225
| [" Undefined" ; " t" ]
@@ -253,6 +252,7 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
253
252
| ( ([" Js" ; " Dict" ; " t" ] | [" Dict" ; " t" ] | [" dict" ] | [" Stdlib" ; " Dict" ; " t" ]),
254
253
[param_translation] ) ->
255
254
{param_translation with type_ = Dict param_translation.type_}
255
+ | [" Stdlib" ; " JSON" ; " t" ], [] -> {dependencies = [] ; type_ = unknown}
256
256
| _ -> default_case ()
257
257
258
258
type process_variant = {
0 commit comments