5
5
| CircularC of string * t
6
6
| FunctionC of functionC
7
7
| IdentC
8
- | ObjectC of fieldsC
9
8
| OptionC of t
10
9
| PromiseC of t
11
10
| TupleC of t list
@@ -15,9 +14,6 @@ and groupedArgConverter =
15
14
| ArgConverter of t
16
15
| GroupConverter of (string * optional * t) list
17
16
18
- and fieldC = {lblJS : string ; lblRE : string ; c : t }
19
- and fieldsC = fieldC list
20
-
21
17
and functionC = {
22
18
funArgConverters : groupedArgConverter list ;
23
19
componentName : string option ;
@@ -66,21 +62,6 @@ let rec toString converter =
66
62
|> String. concat " , " )
67
63
^ " -> " ^ toString retConverter ^ " )"
68
64
| IdentC -> " id"
69
- | ObjectC fieldsC ->
70
- let dot =
71
- match converter with
72
- | ObjectC _ -> " . "
73
- | _ -> " "
74
- in
75
- " {" ^ dot
76
- ^ (fieldsC
77
- |> List. map (fun {lblJS; lblRE; c} ->
78
- (match lblJS = lblRE with
79
- | true -> lblJS
80
- | false -> " (" ^ lblJS ^ " /" ^ lblRE ^ " )" )
81
- ^ " :" ^ (c |> toString))
82
- |> String. concat " , " )
83
- ^ " }"
84
65
| OptionC c -> " option(" ^ toString c ^ " )"
85
66
| PromiseC c -> " promise(" ^ toString c ^ " )"
86
67
| TupleC innerTypesC ->
@@ -191,27 +172,7 @@ let typeGetConverterNormalized ~config ~inline ~lookupId ~typeNameIsInterface
191
172
| Nullable t ->
192
173
let tConverter, tNormalized = t |> visit ~visited in
193
174
(OptionC tConverter, Nullable tNormalized)
194
- | Object (closedFlag , fields ) ->
195
- let fieldsConverted =
196
- fields
197
- |> List. map (fun ({type_} as field ) -> (field, type_ |> visit ~visited ))
198
- in
199
- ( ObjectC
200
- (fieldsConverted
201
- |> List. map (fun ({nameJS; optional} , (converter , _ )) ->
202
- {
203
- lblJS = nameJS;
204
- lblRE = nameJS;
205
- c =
206
- (match optional = Mandatory with
207
- | true -> converter
208
- | false -> OptionC converter);
209
- })),
210
- Object
211
- ( closedFlag,
212
- fieldsConverted
213
- |> List. map (fun (field , (_ , tNormalized )) ->
214
- {field with type_ = tNormalized}) ) )
175
+ | Object _ -> (IdentC , normalized_)
215
176
| Option t ->
216
177
let tConverter, tNormalized = t |> visit ~visited in
217
178
(OptionC tConverter, Option tNormalized)
@@ -357,7 +318,6 @@ let rec converterIsIdentity ~config ~toJS converter =
357
318
argConverter |> converterIsIdentity ~config ~to JS:(not toJS)
358
319
| GroupConverter _ -> false )
359
320
| IdentC -> true
360
- | ObjectC _ -> true
361
321
| OptionC c -> c |> converterIsIdentity ~config ~to JS
362
322
| PromiseC c -> c |> converterIsIdentity ~config ~to JS
363
323
| TupleC innerTypesC ->
@@ -487,33 +447,6 @@ let rec apply ~config ~converter ~indent ~nameGen ~toJS ~variantTables value =
487
447
EmitText. funDef ~body Args ~function Name:componentName ~fun Params ~indent
488
448
~mk Body ~type Vars
489
449
| IdentC -> value
490
- | ObjectC fieldsC ->
491
- let simplifyFieldConverted fieldConverter =
492
- match fieldConverter with
493
- | OptionC converter1 when converter1 |> converterIsIdentity ~config ~to JS
494
- ->
495
- IdentC
496
- | _ -> fieldConverter
497
- in
498
- let fieldValues =
499
- fieldsC
500
- |> List. map (fun {lblJS; lblRE; c = fieldConverter } ->
501
- (match toJS with
502
- | true -> lblJS
503
- | false -> lblRE)
504
- ^ " :"
505
- ^ (value
506
- |> EmitText. fieldAccess
507
- ~label:
508
- (match toJS with
509
- | true -> lblRE
510
- | false -> lblJS)
511
- |> apply ~config
512
- ~converter: (fieldConverter |> simplifyFieldConverted)
513
- ~indent ~name Gen ~to JS ~variant Tables))
514
- |> String. concat " , "
515
- in
516
- " {" ^ fieldValues ^ " }"
517
450
| OptionC c ->
518
451
EmitText. parens
519
452
[
0 commit comments