|
9 | 9 | | ObjectC of fieldsC
|
10 | 10 | | OptionC of t
|
11 | 11 | | PromiseC of t
|
12 |
| - | RecordC of fieldsC |
13 | 12 | | TupleC of t list
|
14 | 13 | | VariantC of variantC
|
15 | 14 |
|
@@ -69,7 +68,7 @@ let rec toString converter =
|
69 | 68 | ^ " -> " ^ toString retConverter ^ ")"
|
70 | 69 | | IdentC -> "id"
|
71 | 70 | | NullableC c -> "nullable(" ^ toString c ^ ")"
|
72 |
| - | ObjectC fieldsC | RecordC fieldsC -> |
| 71 | + | ObjectC fieldsC -> |
73 | 72 | let dot =
|
74 | 73 | match converter with
|
75 | 74 | | ObjectC _ -> ". "
|
@@ -222,26 +221,6 @@ let typeGetConverterNormalized ~config ~inline ~lookupId ~typeNameIsInterface
|
222 | 221 | | Promise t ->
|
223 | 222 | let tConverter, tNormalized = t |> visit ~visited in
|
224 | 223 | (PromiseC tConverter, Promise tNormalized)
|
225 |
| - | Record fields -> |
226 |
| - let fieldsConverted = |
227 |
| - fields |
228 |
| - |> List.map (fun ({type_} as field) -> (field, type_ |> visit ~visited)) |
229 |
| - in |
230 |
| - ( RecordC |
231 |
| - (fieldsConverted |
232 |
| - |> List.map (fun ({nameJS; nameRE; optional}, (converter, _)) -> |
233 |
| - { |
234 |
| - lblJS = nameJS; |
235 |
| - lblRE = nameRE; |
236 |
| - c = |
237 |
| - (match optional = Mandatory with |
238 |
| - | true -> converter |
239 |
| - | false -> OptionC converter); |
240 |
| - })), |
241 |
| - Record |
242 |
| - (fieldsConverted |
243 |
| - |> List.map (fun (field, (_, tNormalized)) -> |
244 |
| - {field with type_ = tNormalized})) ) |
245 | 224 | | Tuple innerTypes ->
|
246 | 225 | let innerConversions, normalizedList =
|
247 | 226 | innerTypes |> List.map (visit ~visited) |> List.split
|
@@ -395,7 +374,6 @@ let rec converterIsIdentity ~config ~toJS converter =
|
395 | 374 | | _ -> c |> converterIsIdentity ~config ~toJS)
|
396 | 375 | | OptionC c -> if toJS then c |> converterIsIdentity ~config ~toJS else false
|
397 | 376 | | PromiseC c -> c |> converterIsIdentity ~config ~toJS
|
398 |
| - | RecordC _ -> false |
399 | 377 | | TupleC innerTypesC ->
|
400 | 378 | innerTypesC |> List.for_all (converterIsIdentity ~config ~toJS)
|
401 | 379 | | VariantC {withPayloads; useVariantTables} ->
|
@@ -581,39 +559,6 @@ let rec apply ~config ~converter ~indent ~nameGen ~toJS ~variantTables value =
|
581 | 559 | ^ ") { return "
|
582 | 560 | ^ (x |> apply ~config ~converter:c ~indent ~nameGen ~toJS ~variantTables)
|
583 | 561 | ^ "})"
|
584 |
| - | RecordC fieldsC -> |
585 |
| - let simplifyFieldConverted fieldConverter = |
586 |
| - match fieldConverter with |
587 |
| - | OptionC converter1 when converter1 |> converterIsIdentity ~config ~toJS |
588 |
| - -> |
589 |
| - IdentC |
590 |
| - | _ -> fieldConverter |
591 |
| - in |
592 |
| - if toJS then |
593 |
| - let fieldValues = |
594 |
| - fieldsC |
595 |
| - |> List.mapi (fun index {lblJS; c = fieldConverter} -> |
596 |
| - lblJS ^ ":" |
597 |
| - ^ (value |
598 |
| - |> EmitText.arrayAccess ~index |
599 |
| - |> apply ~config |
600 |
| - ~converter:(fieldConverter |> simplifyFieldConverted) |
601 |
| - ~indent ~nameGen ~toJS ~variantTables)) |
602 |
| - |> String.concat ", " |
603 |
| - in |
604 |
| - "{" ^ fieldValues ^ "}" |
605 |
| - else |
606 |
| - let fieldValues = |
607 |
| - fieldsC |
608 |
| - |> List.map (fun {lblJS; c = fieldConverter} -> |
609 |
| - value |
610 |
| - |> EmitText.fieldAccess ~label:lblJS |
611 |
| - |> apply ~config |
612 |
| - ~converter:(fieldConverter |> simplifyFieldConverted) |
613 |
| - ~indent ~nameGen ~toJS ~variantTables) |
614 |
| - |> String.concat ", " |
615 |
| - in |
616 |
| - "[" ^ fieldValues ^ "]" |
617 | 562 | | TupleC innerTypesC ->
|
618 | 563 | "["
|
619 | 564 | ^ (innerTypesC
|
|
0 commit comments