@flock/wirespec 0.18.1-RC.2 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/clikt-clikt-mordant.mjs +79 -79
  2. package/clikt-clikt.mjs +1265 -1265
  3. package/clikt-clikt.mjs.map +1 -1
  4. package/colormath-root-colormath.mjs +433 -433
  5. package/kotlin-kotlin-stdlib.mjs +29 -23
  6. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  7. package/kotlin-openapi-bindings.mjs +5407 -5405
  8. package/kotlin-openapi-bindings.mjs.map +1 -1
  9. package/kotlin-rgxgen.mjs +1760 -1760
  10. package/kotlinx-io-kotlinx-io-core.mjs +404 -404
  11. package/kotlinx-serialization-kotlinx-serialization-core.mjs +1701 -1701
  12. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1320 -1319
  13. package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  14. package/mordant-mordant.mjs +1198 -1198
  15. package/package.json +1 -1
  16. package/wirespec-fetch.mjs +13 -19
  17. package/wirespec-src-compiler-core.mjs +193 -206
  18. package/wirespec-src-compiler-core.mjs.map +1 -1
  19. package/wirespec-src-compiler-emitters-java.mjs +718 -784
  20. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  21. package/wirespec-src-compiler-emitters-kotlin.mjs +357 -464
  22. package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
  23. package/wirespec-src-compiler-emitters-python.mjs +628 -757
  24. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  25. package/wirespec-src-compiler-emitters-rust.mjs +1582 -1708
  26. package/wirespec-src-compiler-emitters-rust.mjs.map +1 -1
  27. package/wirespec-src-compiler-emitters-scala.mjs +680 -635
  28. package/wirespec-src-compiler-emitters-scala.mjs.map +1 -1
  29. package/wirespec-src-compiler-emitters-typescript.mjs +627 -610
  30. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  31. package/wirespec-src-compiler-emitters-wirespec.mjs +40 -40
  32. package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
  33. package/wirespec-src-compiler-ir.mjs +5428 -6057
  34. package/wirespec-src-compiler-ir.mjs.map +1 -1
  35. package/wirespec-src-compiler-lib.mjs +279 -279
  36. package/wirespec-src-converter-avro.mjs +559 -559
  37. package/wirespec-src-converter-avro.mjs.map +1 -1
  38. package/wirespec-src-converter-openapi.mjs +802 -404
  39. package/wirespec-src-converter-openapi.mjs.map +1 -1
  40. package/wirespec-src-plugin-arguments.mjs +144 -144
  41. package/wirespec-src-plugin-cli.mjs +87 -87
  42. package/wirespec-src-plugin-npm.mjs +44 -25
  43. package/wirespec-src-plugin-npm.mjs.map +1 -1
  44. package/wirespec-src-tools-generator.mjs +13 -13
@@ -1,136 +1,70 @@
1
1
  import {
2
- Custom2si7lto3wompr as Custom,
3
- Namespace345pal554qu3j as Namespace,
4
- File3dimy4iqmuock as File,
5
- transformChildrend9p91tpcqdkx as transformChildren,
6
- RawElement2yts1x2rbem1g as RawElement,
7
- Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
8
- Enumlszg09mwd24f as Enum,
9
- Interface3pn84xq686t2r as Interface,
10
- TransformScopeyrd3lf4zrk76 as TransformScope,
11
- TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
12
- transform3eti8i2bqvifx as transform,
13
- Elementitq62jg6fid3 as Element,
14
- Function21cuq8qizkin7 as Function,
15
- generateRust223y8gad7tpbz as generateRust,
16
- import5uhkz67bd8tt as import_0,
17
- VariableReference2vlynnhaw1i64 as VariableReference,
18
- FieldCall1iz7z2fx2xo4p as FieldCall,
19
- convertConstraintkgpvomct0x0s as convertConstraint,
20
- function12vu2kapzno4w as function_0,
21
- requestParameters1z8fdizgtviyb as requestParameters,
22
- flattenNestedStructs3rzqu1ggdb6h2 as flattenNestedStructs,
23
- Union38f3pecvfcpxh as Union,
24
- Struct39wf79cwtn4ty as Struct,
25
- Nameoqr8dt2fim9d as Name,
26
- transformChildren2mszeagj5nq4c as transformChildren_0,
27
- sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
28
- ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
29
- SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
30
- interface24qlavvm81r6z as interface_0,
31
- convert13xvfhgrf57n5 as convert,
32
- Importdjdfxu3pjkxa as Import,
33
- RawExpression2bo7ldfrptjia as RawExpression,
34
- transformChildren2m3cpkz6zusq1 as transformChildren_1,
35
- Boolean_instance27opaqtiiiysz as Boolean_instance,
36
- String_instance3uxvo48ki208u as String_instance,
37
- Switch3a1zi3na98deu as Switch,
38
- Case2i7oahw4alz6h as Case,
39
- FunctionCall30872kpnbr7op as FunctionCall,
40
- RustGenerator_instance1aobjdt0upvy as RustGenerator_instance,
41
- emit3bzdcd0f6nwtj as emit,
42
- emitn3eihixilqyh as emit_0,
43
- convertWithValidation3ar3nbcqsbkpn as convertWithValidation,
44
- sanitizeNames2wqmyf8vafp9x as sanitizeNames,
45
- convert11ert2po54h1y as convert_0,
46
- convert37aabdzvtv9vg as convert_1,
47
- convert17zcptkz4mhr4 as convert_2,
48
- convert32tuiui3czihh as convert_3,
49
- convert1cn4bolzoed8c as convert_4,
50
- emit1oxjujel6f3jb as emit_1,
51
- IrEmitterh2m93ojzvkep as IrEmitter,
52
- Parameteruqoxd4rzw7ga as Parameter,
53
- Nullable3wjn6l6q3h6o as Nullable,
54
- Number3azxs9q1cyulb as Number_0,
55
- Integer1uwg1wvo5lp6z as Integer,
56
- Boolean3l1woojgw3q17 as Boolean_0,
57
- String4gxjl3f3e5ya as String_0,
58
- Literal50s1y3607cdv as Literal,
59
- ArrayIndexCall31gemxjfuldqy as ArrayIndexCall,
60
- StringLiteral3ffeojfhsbsmg as StringLiteral,
61
- IntegerLiteral32u4pkji3telv as IntegerLiteral,
62
- Wildcard_instance2ga1ytfwj78ra as Wildcard_instance,
63
- Reflect_instance3i17lxiopj78t as Reflect_instance,
64
- Bytes_instance3edm2lhbrwd51 as Bytes_instance,
65
- Any_instance2998xag3cdzh3 as Any_instance,
66
- Unit_instanceyaei45a6t5rv as Unit_instance,
67
- Dict22iqrhoo0g8et as Dict,
68
- Array2goj74t0aak7b as Array_0,
69
- } from './wirespec-src-compiler-ir.mjs';
70
- import {
71
- Unit_instance28fytmsmm6r23 as Unit_instance_0,
72
- VOID3gxj6tk5isa35 as VOID,
73
- ArrayList_init_$Create$1jemgvhi5v0js as ArrayList_init_$Create$,
74
- first58ocm7j58k3q as first,
75
- plus310ted5e4i90h as plus,
76
- listOfvhqybd2zx248 as listOf,
77
- THROW_CCE2g6jy02ryeudk as THROW_CCE,
78
- KtMap140uvy3s5zad8 as KtMap,
79
- isInterface3d6p8outrmvmk as isInterface,
80
- ensureNotNull1e947j3ixpazm as ensureNotNull,
81
- addAll1k27qatfgp3k5 as addAll,
82
- plus20p0vtfmu0596 as plus_0,
83
- Collection1k04j3hzsbod0 as Collection,
84
- joinToString1cxrrlmo0chqs as joinToString,
85
- _Char___init__impl__6a9atx1csff5kwtduxl as _Char___init__impl__6a9atx,
86
- charArrayOf27f4r3dozbrk1 as charArrayOf,
87
- trimEndvvzjdhan75g as trimEnd,
88
2
  KProperty1ca4yb4wlo496 as KProperty1,
89
3
  getPropertyCallableRef3hckxc0xueiaj as getPropertyCallableRef,
90
4
  split2bvyvnrlcifjv as split,
91
5
  collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
92
- ArrayList_init_$Create$3ivpeip4ouddx as ArrayList_init_$Create$_0,
6
+ ArrayList_init_$Create$3ivpeip4ouddx as ArrayList_init_$Create$,
93
7
  checkIndexOverflow3frtmheghr0th as checkIndexOverflow,
8
+ Unit_instance28fytmsmm6r23 as Unit_instance,
9
+ joinToString1cxrrlmo0chqs as joinToString,
94
10
  StringBuilder_init_$Create$322n630qt3r8c as StringBuilder_init_$Create$,
95
11
  charSequenceLength3278n89t01tmv as charSequenceLength,
96
12
  charSequenceGet1vxk1y5n17t1z as charSequenceGet,
97
13
  isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
14
+ _Char___init__impl__6a9atx1csff5kwtduxl as _Char___init__impl__6a9atx,
98
15
  firstOrNulltrxqttxfxqju as firstOrNull,
99
16
  isDigit3mimrri4wkzop as isDigit,
100
17
  Char19o2r8palgjof as Char,
101
- noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
102
- HashSet_init_$Create$33p49hmosnvr4 as HashSet_init_$Create$,
18
+ VOID3gxj6tk5isa35 as VOID,
19
+ plus310ted5e4i90h as plus,
103
20
  to2cs3ny02qtbcb as to,
104
- firstOrNull1982767dljvdy as firstOrNull_0,
105
- emptyList1g2z5xcrvp2zy as emptyList,
106
- trimIndent1qytc1wvt8suh as trimIndent,
107
21
  setOf45ia9pnfhe90 as setOf,
108
22
  protoOf180f3jzyo7rfj as protoOf,
109
23
  initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
110
24
  equals2au1ep9vhcato as equals,
111
25
  FunctionAdapter3lcrrz3moet5b as FunctionAdapter,
26
+ isInterface3d6p8outrmvmk as isInterface,
112
27
  Comparator2b3maoeh98xtg as Comparator,
113
28
  hashCodeq5arwsb9dgti as hashCode,
114
29
  initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
115
30
  toMap1vec9topfei08 as toMap,
116
31
  minus165a8u1e0x1lu as minus,
117
- listOf1jh22dvmctj1r as listOf_0,
118
- mapOf1xd03cq9cnmy8 as mapOf,
32
+ ArrayList_init_$Create$1jemgvhi5v0js as ArrayList_init_$Create$_0,
33
+ first58ocm7j58k3q as first,
34
+ listOfvhqybd2zx248 as listOf,
35
+ THROW_CCE2g6jy02ryeudk as THROW_CCE,
36
+ KtMap140uvy3s5zad8 as KtMap,
37
+ ensureNotNull1e947j3ixpazm as ensureNotNull,
38
+ addAll1k27qatfgp3k5 as addAll,
39
+ plus20p0vtfmu0596 as plus_0,
40
+ Collection1k04j3hzsbod0 as Collection,
41
+ charArrayOf27f4r3dozbrk1 as charArrayOf,
42
+ trimEndvvzjdhan75g as trimEnd,
119
43
  compareValues1n2ayl87ihzfk as compareValues,
120
- contains3ue2qo8xhmpf1 as contains,
121
44
  charCodeAt1yspne1d8erbm as charCodeAt,
122
45
  uppercaseChar6lahngw3wvwg as uppercaseChar,
123
46
  substring3saq8ornu0luv as substring,
124
47
  toString3dhdjl9yf50de as toString,
125
- removePrefix279df90bhrqqg as removePrefix,
126
- startsWith26w8qjqapeeq6 as startsWith,
127
- mapCapacity1h45rc3eh9p2l as mapCapacity,
128
- LinkedHashMap_init_$Create$1s75e1k23v4xj as LinkedHashMap_init_$Create$,
129
- mapOf2zpbbmyqk8xpf as mapOf_0,
130
48
  lazy2hsh8ze7j6ikd as lazy,
49
+ listOf1jh22dvmctj1r as listOf_0,
50
+ mapOf1xd03cq9cnmy8 as mapOf,
51
+ lastOrNull1aq5oz189qoe1 as lastOrNull,
52
+ firstOrNull1982767dljvdy as firstOrNull_0,
53
+ mutableListOf6oorvk2mtdmp as mutableListOf,
54
+ last1vo29oleiqj36 as last,
131
55
  sortedWith2csnbbb21k0lg as sortedWith,
132
56
  toSet2orjxp16sotqu as toSet,
57
+ HashSet_init_$Create$33p49hmosnvr4 as HashSet_init_$Create$,
133
58
  Regex_init_$Create$9xrx4twz2i6q as Regex_init_$Create$,
59
+ emptyList1g2z5xcrvp2zy as emptyList,
60
+ trimIndent1qytc1wvt8suh as trimIndent,
61
+ startsWith26w8qjqapeeq6 as startsWith,
62
+ contains3ue2qo8xhmpf1 as contains,
63
+ removePrefix279df90bhrqqg as removePrefix,
64
+ mapCapacity1h45rc3eh9p2l as mapCapacity,
65
+ LinkedHashMap_init_$Create$1s75e1k23v4xj as LinkedHashMap_init_$Create$,
66
+ mapOf2zpbbmyqk8xpf as mapOf_0,
67
+ noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
134
68
  getKClassFromExpression348iqjl4fnx2f as getKClassFromExpression,
135
69
  toString1pkumu07cwy4m as toString_0,
136
70
  IllegalStateException_init_$Create$2429fvs1h56dm as IllegalStateException_init_$Create$,
@@ -139,24 +73,89 @@ import {
139
73
  import {
140
74
  Companion_instancebcq57hoyp8c2 as Companion_instance,
141
75
  FieldIdentifier34k7iphndcnl0 as FieldIdentifier,
142
- Channel2fhxi4a4pwb64 as Channel,
143
- Endpoint1jsq06yr3xdhp as Endpoint,
144
- Unionccsavx6nrdr2 as Union_0,
145
- Type12n1gx16iqtcu as Type,
146
- Refined1lkzc0dg6wey7 as Refined,
147
- Enum3l2iuc342kle6 as Enum_0,
148
- importReferencesy4xv7r53sjjs as importReferences,
149
- String1czvr8pxnm6on as String_1,
150
- Shared1uygqfbd22ukz as Shared,
151
- Paramvfwnys2w6aj1 as Param,
152
- Literal331hu9r04vptz as Literal_0,
153
76
  Companion_instance1a2xqc448tlhh as Companion_instance_0,
154
77
  Companion_instance2ryk3262e300f as Companion_instance_1,
155
78
  FileExtension_Rust_getInstance2x338tl89inw as FileExtension_Rust_getInstance,
79
+ Endpoint1jsq06yr3xdhp as Endpoint,
156
80
  Model1nx3had6rojzt as Model,
157
81
  plus3lrm73de10b42 as plus_1,
82
+ importReferencesy4xv7r53sjjs as importReferences,
158
83
  plus14o24vdaiongg as plus_2,
84
+ String1czvr8pxnm6on as String_0,
85
+ Paramvfwnys2w6aj1 as Param,
86
+ Literal331hu9r04vptz as Literal,
159
87
  } from './wirespec-src-compiler-core.mjs';
88
+ import {
89
+ Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
90
+ requestParameters1z8fdizgtviyb as requestParameters,
91
+ Nameoqr8dt2fim9d as Name,
92
+ transformChildren2mszeagj5nq4c as transformChildren,
93
+ sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
94
+ ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
95
+ SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
96
+ Custom2si7lto3wompr as Custom,
97
+ Namespace345pal554qu3j as Namespace,
98
+ File3dimy4iqmuock as File,
99
+ transformChildrend9p91tpcqdkx as transformChildren_0,
100
+ RawElement2yts1x2rbem1g as RawElement,
101
+ Enumlszg09mwd24f as Enum,
102
+ Interface3pn84xq686t2r as Interface,
103
+ TransformScopeyrd3lf4zrk76 as TransformScope,
104
+ TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
105
+ transform3eti8i2bqvifx as transform,
106
+ Elementitq62jg6fid3 as Element,
107
+ Function21cuq8qizkin7 as Function,
108
+ RustGenerator_instance1aobjdt0upvy as RustGenerator_instance,
109
+ sortKey2uc13shubz5xy as sortKey,
110
+ import5uhkz67bd8tt as import_0,
111
+ interface24qlavvm81r6z as interface_0,
112
+ convertnty9x0e63d0u as convert,
113
+ Struct39wf79cwtn4ty as Struct,
114
+ Importdjdfxu3pjkxa as Import,
115
+ emit3bzdcd0f6nwtj as emit,
116
+ emitn3eihixilqyh as emit_0,
117
+ convertWithValidation3ar3nbcqsbkpn as convertWithValidation,
118
+ injectSelfReceiverToValidate4xgr9r5gl5n3 as injectSelfReceiverToValidate,
119
+ sanitizeNames2wqmyf8vafp9x as sanitizeNames,
120
+ convert11ert2po54h1y as convert_0,
121
+ sanitizeEnumEntries3pphrvzq8r9fn as sanitizeEnumEntries,
122
+ convert37aabdzvtv9vg as convert_1,
123
+ convert17zcptkz4mhr4 as convert_2,
124
+ convert32tuiui3czihh as convert_3,
125
+ convert1cn4bolzoed8c as convert_4,
126
+ emit1oxjujel6f3jb as emit_1,
127
+ IrEmitterh2m93ojzvkep as IrEmitter,
128
+ flattenNestedStructs2956rxx8q2zxl as flattenNestedStructs,
129
+ Union38f3pecvfcpxh as Union,
130
+ VariableReference2vlynnhaw1i64 as VariableReference,
131
+ FieldCall1iz7z2fx2xo4p as FieldCall,
132
+ convertConstraintkgpvomct0x0s as convertConstraint,
133
+ function12vu2kapzno4w as function_0,
134
+ Switch3a1zi3na98deu as Switch,
135
+ Case2i7oahw4alz6h as Case,
136
+ RawExpression2bo7ldfrptjia as RawExpression,
137
+ transformChildren2m3cpkz6zusq1 as transformChildren_1,
138
+ FunctionCall30872kpnbr7op as FunctionCall,
139
+ Boolean_instance27opaqtiiiysz as Boolean_instance,
140
+ String_instance3uxvo48ki208u as String_instance,
141
+ Parameteruqoxd4rzw7ga as Parameter,
142
+ Nullable3wjn6l6q3h6o as Nullable,
143
+ Number3azxs9q1cyulb as Number_0,
144
+ Integer1uwg1wvo5lp6z as Integer,
145
+ Boolean3l1woojgw3q17 as Boolean_0,
146
+ String4gxjl3f3e5ya as String_1,
147
+ Literal50s1y3607cdv as Literal_0,
148
+ ArrayIndexCall31gemxjfuldqy as ArrayIndexCall,
149
+ StringLiteral3ffeojfhsbsmg as StringLiteral,
150
+ IntegerLiteral32u4pkji3telv as IntegerLiteral,
151
+ Wildcard_instance2ga1ytfwj78ra as Wildcard_instance,
152
+ Reflect_instance3i17lxiopj78t as Reflect_instance,
153
+ Bytes_instance3edm2lhbrwd51 as Bytes_instance,
154
+ Any_instance2998xag3cdzh3 as Any_instance,
155
+ Unit_instanceyaei45a6t5rv as Unit_instance_0,
156
+ Dict22iqrhoo0g8et as Dict,
157
+ Array2goj74t0aak7b as Array_0,
158
+ } from './wirespec-src-compiler-ir.mjs';
160
159
  import {
161
160
  NonEmptyList3ak25ihy2gcvs as NonEmptyList,
162
161
  toNonEmptyListOrNull2ovnnazjb3msz as toNonEmptyListOrNull,
@@ -167,184 +166,391 @@ import {
167
166
  //region block: pre-declaration
168
167
  initMetadataForCompanion(Companion);
169
168
  initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
170
- initMetadataForClass(RustIrEmitter$shared$1);
171
169
  initMetadataForClass(RustIrEmitter, 'RustIrEmitter', RustIrEmitter, VOID, [IrEmitter]);
172
170
  initMetadataForObject(RustTransform, 'RustTransform');
173
171
  //endregion
174
- function get_selfParam() {
175
- _init_properties_RustIrEmitter_kt__j995rl();
176
- return selfParam;
177
- }
178
- var selfParam;
179
- function get_RESPONSE_PATTERN() {
180
- _init_properties_RustIrEmitter_kt__j995rl();
181
- return RESPONSE_PATTERN;
182
- }
183
- var RESPONSE_PATTERN;
184
- function RustIrEmitter$shared$o$requestHeaders$lambda($this$interface) {
185
- $this$interface.e1j(new Custom('Headers'));
186
- return Unit_instance_0;
187
- }
188
- function RustIrEmitter$shared$o$responseHeaders$lambda($this$interface) {
189
- $this$interface.e1j(new Custom('Headers'));
190
- return Unit_instance_0;
191
- }
192
- function RustIrEmitter$shared$o$enumTrait$lambda($this$interface) {
193
- $this$interface.e1j(new Custom('Sized'));
194
- $this$interface.b1i('label', VOID, VOID, RustIrEmitter$shared$o$enumTrait$lambda$lambda);
195
- $this$interface.b1i('from_label', true, VOID, RustIrEmitter$shared$o$enumTrait$lambda$lambda_0);
196
- return Unit_instance_0;
197
- }
198
- function RustIrEmitter$shared$o$enumTrait$lambda$lambda($this$function) {
199
- $this$function.l1i('&self', new Custom(''));
200
- $this$function.k1i(new Custom('&str'));
201
- return Unit_instance_0;
202
- }
203
- function RustIrEmitter$shared$o$enumTrait$lambda$lambda_0($this$function) {
204
- $this$function.l1i('s', new Custom('&str'));
205
- $this$function.k1i(new Custom('Option<Self>'));
206
- return Unit_instance_0;
207
- }
208
- function RustIrEmitter$shared$o$refinedTrait$lambda($this$interface) {
209
- $this$interface.a1i($this$interface.t1h('T', []), []);
210
- $this$interface.b1i('value', VOID, VOID, RustIrEmitter$shared$o$refinedTrait$lambda$lambda);
211
- $this$interface.b1i('validate', VOID, VOID, RustIrEmitter$shared$o$refinedTrait$lambda$lambda_0);
212
- return Unit_instance_0;
213
- }
214
- function RustIrEmitter$shared$o$refinedTrait$lambda$lambda($this$function) {
215
- $this$function.l1i('&self', new Custom(''));
216
- $this$function.k1i(borrow($this$function.t1h('T', [])));
217
- return Unit_instance_0;
218
- }
219
- function RustIrEmitter$shared$o$refinedTrait$lambda$lambda_0($this$function) {
220
- $this$function.l1i('&self', new Custom(''));
221
- $this$function.k1i($this$function.s1i());
222
- return Unit_instance_0;
223
- }
224
- function RustIrEmitter$shared$o$requestTrait$lambda($this$interface) {
225
- $this$interface.a1i($this$interface.t1h('T', []), []);
226
- $this$interface.m1i('path', borrowDyn($this$interface.t1h('Path', [])));
227
- $this$interface.m1i('method', borrow($this$interface.t1h('Method', [])));
228
- $this$interface.m1i('queries', borrowDyn($this$interface.t1h('Queries', [])));
229
- $this$interface.m1i('headers', borrowDyn($this$interface.t1h('RequestHeaders', [])));
230
- $this$interface.m1i('body', borrow($this$interface.t1h('T', [])));
231
- return Unit_instance_0;
232
- }
233
- function RustIrEmitter$shared$o$responseTrait$lambda($this$interface) {
234
- $this$interface.a1i($this$interface.t1h('T', []), []);
235
- $this$interface.m1i('status', $this$interface.n1t());
236
- $this$interface.m1i('headers', borrowDyn($this$interface.t1h('ResponseHeaders', [])));
237
- $this$interface.m1i('body', borrow($this$interface.t1h('T', [])));
238
- return Unit_instance_0;
239
- }
240
- function RustIrEmitter$shared$o$transportationTrait$lambda($this$interface) {
241
- $this$interface.o1j('transport', VOID, VOID, RustIrEmitter$shared$o$transportationTrait$lambda$lambda);
242
- return Unit_instance_0;
243
- }
244
- function RustIrEmitter$shared$o$transportationTrait$lambda$lambda($this$asyncFunction) {
245
- $this$asyncFunction.l1i('&self', new Custom(''));
246
- $this$asyncFunction.l1i('request', borrow($this$asyncFunction.t1h('RawRequest', [])));
247
- $this$asyncFunction.k1i($this$asyncFunction.t1h('RawResponse', []));
248
- return Unit_instance_0;
249
- }
250
- function RustIrEmitter$shared$o$wirespecFile$lambda(this$0) {
251
- return function (element, transformer) {
252
- var tmp;
253
- if (element instanceof File) {
254
- // Inline function 'kotlin.collections.filterIsInstance' call
255
- var tmp0 = element.u1m_1;
256
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
257
- var destination = ArrayList_init_$Create$();
258
- var _iterator__ex2g4s = tmp0.t();
259
- while (_iterator__ex2g4s.u()) {
260
- var element_0 = _iterator__ex2g4s.v();
261
- if (element_0 instanceof Namespace) {
262
- destination.x(element_0);
263
- }
172
+ function _get_sanitizationConfig__sns434($this) {
173
+ var tmp0 = $this.y1x_1;
174
+ var tmp = KProperty1;
175
+ // Inline function 'kotlin.getValue' call
176
+ getPropertyCallableRef('sanitizationConfig', 1, tmp, RustIrEmitter$_get_sanitizationConfig_$ref_17ypni(), null);
177
+ return tmp0.l1();
178
+ }
179
+ function sanitize($this, _this__u8e3s4) {
180
+ // Inline function 'kotlin.collections.mapIndexed' call
181
+ var this_0 = split(_this__u8e3s4.l1(), ['.', ' ']);
182
+ // Inline function 'kotlin.collections.mapIndexedTo' call
183
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
184
+ var index = 0;
185
+ var _iterator__ex2g4s = this_0.t();
186
+ while (_iterator__ex2g4s.u()) {
187
+ var item = _iterator__ex2g4s.v();
188
+ var _unary__edvuaz = index;
189
+ index = _unary__edvuaz + 1 | 0;
190
+ var tmp$ret$0 = checkIndexOverflow(_unary__edvuaz) > 0 ? Companion_instance.oq(item) : item;
191
+ destination.x(tmp$ret$0);
192
+ }
193
+ // Inline function 'kotlin.text.filter' call
194
+ var tmp0 = joinToString(destination, '');
195
+ // Inline function 'kotlin.text.filterTo' call
196
+ var destination_0 = StringBuilder_init_$Create$();
197
+ var inductionVariable = 0;
198
+ var last = charSequenceLength(tmp0);
199
+ if (inductionVariable < last)
200
+ do {
201
+ var index_0 = inductionVariable;
202
+ inductionVariable = inductionVariable + 1 | 0;
203
+ var element = charSequenceGet(tmp0, index_0);
204
+ if (isLetterOrDigit(element) || element === _Char___init__impl__6a9atx(95)) {
205
+ destination_0.s(element);
264
206
  }
265
- var namespace = first(destination);
266
- tmp = element.x1m(VOID, plus(this$0.s1y_1, namespace.a1n_1));
267
- } else {
268
- tmp = element;
269
207
  }
270
- var transformed = tmp;
271
- return transformChildren(transformed, transformer);
272
- };
273
- }
274
- function RustIrEmitter$shared$o$wirespecFile$lambda_0(element, transformer) {
208
+ while (inductionVariable < last);
209
+ // Inline function 'kotlin.let' call
210
+ var it = destination_0.toString();
275
211
  var tmp;
276
- if (element instanceof Enum) {
277
- var tmp_0;
278
- if (element.d1o_1.equals(Companion_getInstance().m1h('Method'))) {
279
- tmp_0 = new RawElement('#[derive(Debug, Clone, Default, PartialEq)]\npub enum Method {\n #[default]\n GET,\n PUT,\n POST,\n DELETE,\n OPTIONS,\n HEAD,\n PATCH,\n TRACE,\n}');
280
- } else {
281
- tmp_0 = element;
282
- }
283
- tmp = tmp_0;
212
+ var tmp0_safe_receiver = firstOrNull(it);
213
+ var tmp_0;
214
+ var tmp_1 = tmp0_safe_receiver;
215
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
216
+ tmp_0 = null;
284
217
  } else {
285
- tmp = element;
218
+ tmp_0 = isDigit(tmp0_safe_receiver);
286
219
  }
287
- var transformed = tmp;
288
- return transformChildren(transformed, transformer);
289
- }
290
- function RustIrEmitter$shared$o$wirespecFile$lambda_1(this$0) {
291
- return function (element, transformer) {
292
- var tmp;
293
- if (element instanceof File) {
294
- // Inline function 'kotlin.collections.flatMap' call
295
- var tmp0 = element.u1m_1;
220
+ if (tmp_0 === true) {
221
+ tmp = '_' + it;
222
+ } else {
223
+ tmp = it;
224
+ }
225
+ // Inline function 'kotlin.let' call
226
+ var it_0 = tmp;
227
+ var tmp_2;
228
+ if (_this__u8e3s4 instanceof FieldIdentifier) {
229
+ tmp_2 = sanitizeKeywords($this, it_0);
230
+ } else {
231
+ tmp_2 = it_0;
232
+ }
233
+ var tmp$ret$9 = tmp_2;
234
+ return toSnakeCase($this, tmp$ret$9);
235
+ }
236
+ function toSnakeCase($this, _this__u8e3s4) {
237
+ return Companion_getInstance().l1h(_this__u8e3s4).x1l();
238
+ }
239
+ function toPascalCase($this, _this__u8e3s4) {
240
+ var tmp = split(_this__u8e3s4, ['_']);
241
+ return joinToString(tmp, '', VOID, VOID, VOID, VOID, RustIrEmitter$toPascalCase$lambda);
242
+ }
243
+ function sanitizeKeywords($this, _this__u8e3s4) {
244
+ return Companion_getInstance_0().b1y_1.u1(_this__u8e3s4) ? 'r#' + _this__u8e3s4 : _this__u8e3s4;
245
+ }
246
+ function sanitizeEnum($this, _this__u8e3s4) {
247
+ // Inline function 'kotlin.let' call
248
+ var it = toPascalCase($this, joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_'));
249
+ var tmp;
250
+ var tmp0_safe_receiver = firstOrNull(it);
251
+ var tmp_0;
252
+ var tmp_1 = tmp0_safe_receiver;
253
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
254
+ tmp_0 = null;
255
+ } else {
256
+ tmp_0 = isDigit(tmp0_safe_receiver);
257
+ }
258
+ if (tmp_0 === true) {
259
+ tmp = '_' + it;
260
+ } else {
261
+ tmp = it;
262
+ }
263
+ return tmp;
264
+ }
265
+ function prependImports($this, _this__u8e3s4, imports) {
266
+ var tmp;
267
+ // Inline function 'kotlin.collections.isNotEmpty' call
268
+ if (!imports.r()) {
269
+ tmp = _this__u8e3s4.v1m(VOID, plus(imports, _this__u8e3s4.s1m_1));
270
+ } else {
271
+ tmp = _this__u8e3s4;
272
+ }
273
+ return tmp;
274
+ }
275
+ function buildClientParams($this, _this__u8e3s4) {
276
+ var params = requestParameters(_this__u8e3s4);
277
+ var argsStr = joinToString(params, ', ', VOID, VOID, VOID, VOID, RustIrEmitter$buildClientParams$lambda($this));
278
+ var tmp;
279
+ if (params.r()) {
280
+ tmp = '';
281
+ } else {
282
+ tmp = ', ' + joinToString(params, ', ', VOID, VOID, VOID, VOID, RustIrEmitter$buildClientParams$lambda_0($this));
283
+ }
284
+ var paramsStr = tmp;
285
+ return to(paramsStr, argsStr);
286
+ }
287
+ function Companion() {
288
+ Companion_instance_2 = this;
289
+ this.b1y_1 = setOf(['as', 'break', 'const', 'continue', 'crate', 'else', 'enum', 'extern', 'false', 'fn', 'for', 'if', 'impl', 'in', 'let', 'loop', 'match', 'mod', 'move', 'mut', 'pub', 'ref', 'return', 'self', 'Self', 'static', 'struct', 'super', 'trait', 'true', 'type', 'unsafe', 'use', 'where', 'while', 'async', 'await', 'dyn', 'abstract', 'become', 'box', 'do', 'final', 'macro', 'override', 'priv', 'typeof', 'unsized', 'virtual', 'yield', 'try']);
290
+ }
291
+ var Companion_instance_2;
292
+ function Companion_getInstance_0() {
293
+ if (Companion_instance_2 == null)
294
+ new Companion();
295
+ return Companion_instance_2;
296
+ }
297
+ function sam$kotlin_Comparator$0(function_0) {
298
+ this.c1y_1 = function_0;
299
+ }
300
+ protoOf(sam$kotlin_Comparator$0).qd = function (a, b) {
301
+ return this.c1y_1(a, b);
302
+ };
303
+ protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
304
+ return this.qd(a, b);
305
+ };
306
+ protoOf(sam$kotlin_Comparator$0).l3 = function () {
307
+ return this.c1y_1;
308
+ };
309
+ protoOf(sam$kotlin_Comparator$0).equals = function (other) {
310
+ var tmp;
311
+ if (!(other == null) ? isInterface(other, Comparator) : false) {
312
+ var tmp_0;
313
+ if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
314
+ tmp_0 = equals(this.l3(), other.l3());
315
+ } else {
316
+ tmp_0 = false;
317
+ }
318
+ tmp = tmp_0;
319
+ } else {
320
+ tmp = false;
321
+ }
322
+ return tmp;
323
+ };
324
+ protoOf(sam$kotlin_Comparator$0).hashCode = function () {
325
+ return hashCode(this.l3());
326
+ };
327
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
328
+ return 'r#' + it;
329
+ }
330
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(name) {
331
+ return Companion_getInstance().l1h((new Name(name.m1h_1)).x1l());
332
+ }
333
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(name) {
334
+ var value = name.r1h();
335
+ switch (value) {
336
+ case 'self':
337
+ case '&self':
338
+ return name;
339
+ default:
340
+ return Companion_getInstance().l1h((new Name(name.m1h_1)).x1l());
341
+ }
342
+ }
343
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(it) {
344
+ return it;
345
+ }
346
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
347
+ return function (stmt, tr) {
348
+ var tmp;
349
+ if (stmt instanceof ConstructorStatement) {
350
+ var tmp_0 = tr.o1t(stmt.o1m_1);
351
+ // Inline function 'kotlin.collections.map' call
352
+ var this_0 = stmt.p1m_1;
353
+ // Inline function 'kotlin.collections.mapTo' call
354
+ var destination = ArrayList_init_$Create$(this_0.a1());
355
+ // Inline function 'kotlin.collections.iterator' call
356
+ var _iterator__ex2g4s = this_0.j1().t();
357
+ while (_iterator__ex2g4s.u()) {
358
+ var item = _iterator__ex2g4s.v();
359
+ // Inline function 'kotlin.collections.component1' call
360
+ var k = item.k1();
361
+ // Inline function 'kotlin.collections.component2' call
362
+ var v = item.l1();
363
+ var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), k), tr.r1t(v));
364
+ destination.x(tmp$ret$3);
365
+ }
366
+ tmp = new ConstructorStatement(tmp_0, toMap(destination));
367
+ } else {
368
+ tmp = transformChildren(stmt, tr);
369
+ }
370
+ return tmp;
371
+ };
372
+ }
373
+ function RustIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
374
+ return function () {
375
+ var tmp0_reservedKeywords = minus(Companion_getInstance_0().b1y_1, setOf(['self', 'Self']));
376
+ var tmp = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda;
377
+ var tmp_0 = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_0;
378
+ var tmp_1 = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_1;
379
+ var tmp_2 = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_2;
380
+ return new SanitizationConfig(tmp0_reservedKeywords, tmp, tmp_0, tmp_1, tmp_2, RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0), true);
381
+ };
382
+ }
383
+ function RustIrEmitter$_get_sanitizationConfig_$ref_17ypni() {
384
+ return function (p0) {
385
+ return _get_sanitizationConfig__sns434(p0);
386
+ };
387
+ }
388
+ function RustIrEmitter$emitShared$lambda($this$interface) {
389
+ $this$interface.d1j(new Custom('Headers'));
390
+ return Unit_instance;
391
+ }
392
+ function RustIrEmitter$emitShared$lambda_0($this$interface) {
393
+ $this$interface.d1j(new Custom('Headers'));
394
+ return Unit_instance;
395
+ }
396
+ function RustIrEmitter$emitShared$lambda_1($this$interface) {
397
+ $this$interface.d1j(new Custom('Sized'));
398
+ $this$interface.a1i('label', VOID, VOID, RustIrEmitter$emitShared$lambda$lambda);
399
+ $this$interface.a1i('from_label', true, VOID, RustIrEmitter$emitShared$lambda$lambda_0);
400
+ return Unit_instance;
401
+ }
402
+ function RustIrEmitter$emitShared$lambda$lambda($this$function) {
403
+ $this$function.k1i('&self', new Custom(''));
404
+ $this$function.j1i(new Custom('&str'));
405
+ return Unit_instance;
406
+ }
407
+ function RustIrEmitter$emitShared$lambda$lambda_0($this$function) {
408
+ $this$function.k1i('s', new Custom('&str'));
409
+ $this$function.j1i(new Custom('Option<Self>'));
410
+ return Unit_instance;
411
+ }
412
+ function RustIrEmitter$emitShared$lambda_2($this$interface) {
413
+ $this$interface.z1h($this$interface.s1h('T', []), []);
414
+ $this$interface.a1i('value', VOID, VOID, RustIrEmitter$emitShared$lambda$lambda_1);
415
+ $this$interface.a1i('validate', VOID, VOID, RustIrEmitter$emitShared$lambda$lambda_2);
416
+ return Unit_instance;
417
+ }
418
+ function RustIrEmitter$emitShared$lambda$lambda_1($this$function) {
419
+ $this$function.k1i('&self', new Custom(''));
420
+ $this$function.j1i(borrow($this$function.s1h('T', [])));
421
+ return Unit_instance;
422
+ }
423
+ function RustIrEmitter$emitShared$lambda$lambda_2($this$function) {
424
+ $this$function.k1i('&self', new Custom(''));
425
+ $this$function.j1i($this$function.r1i());
426
+ return Unit_instance;
427
+ }
428
+ function RustIrEmitter$emitShared$lambda_3($this$interface) {
429
+ $this$interface.z1h($this$interface.s1h('T', []), []);
430
+ $this$interface.l1i('path', borrowDyn($this$interface.s1h('Path', [])));
431
+ $this$interface.l1i('method', borrow($this$interface.s1h('Method', [])));
432
+ $this$interface.l1i('queries', borrowDyn($this$interface.s1h('Queries', [])));
433
+ $this$interface.l1i('headers', borrowDyn($this$interface.s1h('RequestHeaders', [])));
434
+ $this$interface.l1i('body', borrow($this$interface.s1h('T', [])));
435
+ return Unit_instance;
436
+ }
437
+ function RustIrEmitter$emitShared$lambda_4($this$interface) {
438
+ $this$interface.z1h($this$interface.s1h('T', []), []);
439
+ $this$interface.l1i('status', $this$interface.k1t());
440
+ $this$interface.l1i('headers', borrowDyn($this$interface.s1h('ResponseHeaders', [])));
441
+ $this$interface.l1i('body', borrow($this$interface.s1h('T', [])));
442
+ return Unit_instance;
443
+ }
444
+ function RustIrEmitter$emitShared$lambda_5($this$interface) {
445
+ $this$interface.n1j('transport', VOID, VOID, RustIrEmitter$emitShared$lambda$lambda_3);
446
+ return Unit_instance;
447
+ }
448
+ function RustIrEmitter$emitShared$lambda$lambda_3($this$asyncFunction) {
449
+ $this$asyncFunction.k1i('&self', new Custom(''));
450
+ $this$asyncFunction.k1i('request', borrow($this$asyncFunction.s1h('RawRequest', [])));
451
+ $this$asyncFunction.j1i($this$asyncFunction.s1h('RawResponse', []));
452
+ return Unit_instance;
453
+ }
454
+ function RustIrEmitter$emitShared$lambda_6($rustImports) {
455
+ return function (element, transformer) {
456
+ var tmp;
457
+ if (element instanceof File) {
458
+ // Inline function 'kotlin.collections.filterIsInstance' call
459
+ var tmp0 = element.s1m_1;
460
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
461
+ var destination = ArrayList_init_$Create$_0();
462
+ var _iterator__ex2g4s = tmp0.t();
463
+ while (_iterator__ex2g4s.u()) {
464
+ var element_0 = _iterator__ex2g4s.v();
465
+ if (element_0 instanceof Namespace) {
466
+ destination.x(element_0);
467
+ }
468
+ }
469
+ var namespace = first(destination);
470
+ tmp = element.v1m(VOID, plus($rustImports, namespace.y1m_1));
471
+ } else {
472
+ tmp = element;
473
+ }
474
+ var transformed = tmp;
475
+ return transformChildren_0(transformed, transformer);
476
+ };
477
+ }
478
+ function RustIrEmitter$emitShared$lambda_7(element, transformer) {
479
+ var tmp;
480
+ if (element instanceof Enum) {
481
+ var tmp_0;
482
+ if (element.w1n_1.equals(Companion_getInstance().l1h('Method'))) {
483
+ tmp_0 = new RawElement('#[derive(Debug, Clone, Default, PartialEq)]\npub enum Method {\n #[default]\n GET,\n PUT,\n POST,\n DELETE,\n OPTIONS,\n HEAD,\n PATCH,\n TRACE,\n}');
484
+ } else {
485
+ tmp_0 = element;
486
+ }
487
+ tmp = tmp_0;
488
+ } else {
489
+ tmp = element;
490
+ }
491
+ var transformed = tmp;
492
+ return transformChildren_0(transformed, transformer);
493
+ }
494
+ function RustIrEmitter$emitShared$lambda_8($dslTraits, $requestHeaders, $responseHeaders, $rawElementInterfaces, $client, $server) {
495
+ return function (element, transformer) {
496
+ var tmp;
497
+ if (element instanceof File) {
498
+ // Inline function 'kotlin.collections.flatMap' call
499
+ var tmp0 = element.s1m_1;
296
500
  // Inline function 'kotlin.collections.flatMapTo' call
297
- var destination = ArrayList_init_$Create$();
501
+ var destination = ArrayList_init_$Create$_0();
298
502
  var _iterator__ex2g4s = tmp0.t();
299
503
  while (_iterator__ex2g4s.u()) {
300
504
  var element_0 = _iterator__ex2g4s.v();
301
- var tmp_0;
302
- if (element_0 instanceof Interface) {
303
- var name = element_0.m1o_1.x1l();
304
- var tmp_1;
505
+ var tmp$ret$0;
506
+ $l$block: {
507
+ if (!(element_0 instanceof Interface)) {
508
+ tmp$ret$0 = listOf(element_0);
509
+ break $l$block;
510
+ }
511
+ var name = element_0.j1n_1.w1l();
512
+ var tmp_0;
305
513
  // Inline function 'kotlin.collections.contains' call
306
514
  // Inline function 'kotlin.collections.containsKey' call
307
- var this_0 = this$0.d1z_1;
515
+ var this_0 = $dslTraits;
308
516
  if ((isInterface(this_0, KtMap) ? this_0 : THROW_CCE()).n2(name)) {
309
517
  // Inline function 'kotlin.collections.buildList' call
310
518
  // Inline function 'kotlin.collections.buildListInternal' call
311
519
  // Inline function 'kotlin.apply' call
312
- var this_1 = ArrayList_init_$Create$();
313
- this_1.x(ensureNotNull(this$0.d1z_1.p2(name)));
520
+ var this_1 = ArrayList_init_$Create$_0();
521
+ this_1.x(ensureNotNull($dslTraits.p2(name)));
314
522
  if (name === 'Request') {
315
- this_1.x(this$0.t1y_1);
523
+ this_1.x($requestHeaders);
316
524
  }
317
525
  if (name === 'Response') {
318
- this_1.x(this$0.u1y_1);
526
+ this_1.x($responseHeaders);
319
527
  }
320
- tmp_1 = this_1.o5();
528
+ tmp_0 = this_1.o5();
321
529
  } else {
322
530
  // Inline function 'kotlin.collections.contains' call
323
531
  // Inline function 'kotlin.collections.containsKey' call
324
- var this_2 = this$0.b1z_1;
532
+ var this_2 = $rawElementInterfaces;
325
533
  if ((isInterface(this_2, KtMap) ? this_2 : THROW_CCE()).n2(name)) {
326
- tmp_1 = listOf(ensureNotNull(this$0.b1z_1.p2(name)));
534
+ tmp_0 = listOf(ensureNotNull($rawElementInterfaces.p2(name)));
327
535
  } else {
328
- tmp_1 = listOf(element_0);
536
+ tmp_0 = listOf(element_0);
329
537
  }
330
538
  }
331
- tmp_0 = tmp_1;
332
- } else {
333
- tmp_0 = listOf(element_0);
539
+ tmp$ret$0 = tmp_0;
334
540
  }
335
- var list = tmp_0;
541
+ var list = tmp$ret$0;
336
542
  addAll(destination, list);
337
543
  }
338
- var newElements = plus_0(plus_0(destination, this$0.v1y_1), this$0.w1y_1);
339
- tmp = element.x1m(VOID, newElements);
544
+ var newElements = plus_0(plus_0(destination, $client), $server);
545
+ tmp = element.v1m(VOID, newElements);
340
546
  } else {
341
547
  tmp = element;
342
548
  }
343
549
  var transformed = tmp;
344
- return transformChildren(transformed, transformer);
550
+ return transformChildren_0(transformed, transformer);
345
551
  };
346
552
  }
347
- function RustIrEmitter$shared$o$source$lambda(element, transformer) {
553
+ function RustIrEmitter$emitShared$lambda_9(element, transformer) {
348
554
  var tmp;
349
555
  if (element instanceof Interface) {
350
556
  // Inline function 'community.flock.wirespec.ir.core.transform' call
@@ -352,25 +558,25 @@ function RustIrEmitter$shared$o$source$lambda(element, transformer) {
352
558
  // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
353
559
  var tmp_0 = scope;
354
560
  // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
355
- var this_0 = scope.z1t_1;
561
+ var this_0 = scope.w1t_1;
356
562
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
357
563
  // Inline function 'kotlin.apply' call
358
564
  var this_1 = new TransformerBuilder();
359
- this_1.d1h(RustIrEmitter$shared$o$source$lambda$lambda);
360
- var tmp$ret$2 = this_1.e1h();
361
- tmp_0.z1t_1 = transform(this_0, tmp$ret$2);
362
- var tmp_1 = scope.z1t_1;
565
+ this_1.c1h(RustIrEmitter$emitShared$lambda$lambda_4);
566
+ var tmp$ret$2 = this_1.d1h();
567
+ tmp_0.w1t_1 = transform(this_0, tmp$ret$2);
568
+ var tmp_1 = scope.w1t_1;
363
569
  tmp = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
364
570
  } else {
365
571
  tmp = element;
366
572
  }
367
573
  var transformed = tmp;
368
- return transformChildren(transformed, transformer);
574
+ return transformChildren_0(transformed, transformer);
369
575
  }
370
- function RustIrEmitter$shared$o$source$lambda$lambda(element, transformer) {
576
+ function RustIrEmitter$emitShared$lambda$lambda_4(element, transformer) {
371
577
  var tmp;
372
578
  if (element instanceof Function) {
373
- var tmp0 = element.v1j_1;
579
+ var tmp0 = element.u1j_1;
374
580
  var tmp$ret$0;
375
581
  $l$block_0: {
376
582
  // Inline function 'kotlin.collections.any' call
@@ -387,7 +593,7 @@ function RustIrEmitter$shared$o$source$lambda$lambda(element, transformer) {
387
593
  var _iterator__ex2g4s = tmp0.t();
388
594
  while (_iterator__ex2g4s.u()) {
389
595
  var element_0 = _iterator__ex2g4s.v();
390
- if (element_0.v1n_1.s1h() === '&self' || element_0.v1n_1.s1h() === 'self') {
596
+ if (element_0.t1o_1.r1h() === '&self' || element_0.t1o_1.r1h() === 'self') {
391
597
  tmp$ret$0 = true;
392
598
  break $l$block_0;
393
599
  }
@@ -395,1048 +601,1151 @@ function RustIrEmitter$shared$o$source$lambda$lambda(element, transformer) {
395
601
  tmp$ret$0 = false;
396
602
  }
397
603
  var hasSelf = tmp$ret$0;
398
- var tmp_1;
399
- if (!hasSelf && !element.z1j_1) {
400
- tmp_1 = element.b1k(VOID, VOID, plus(listOf(get_selfParam()), element.v1j_1));
401
- } else {
402
- tmp_1 = element;
403
- }
404
- tmp = tmp_1;
604
+ tmp = hasSelf || element.y1j_1 ? element : element.a1k(VOID, VOID, plus(listOf(get_rustSelfParam()), element.u1j_1));
405
605
  } else {
406
606
  tmp = element;
407
607
  }
408
608
  var transformed = tmp;
409
- return transformChildren(transformed, transformer);
410
- }
411
- function RustIrEmitter$shared$o$source$lambda_0(group) {
412
- return trimEnd(joinToString(group, '', VOID, VOID, VOID, VOID, RustIrEmitter$shared$o$source$lambda$lambda_0), charArrayOf([_Char___init__impl__6a9atx(10)]));
609
+ return transformChildren_0(transformed, transformer);
413
610
  }
414
- function RustIrEmitter$shared$o$source$lambda$lambda_0(it) {
415
- return generateRust(it);
611
+ function RustIrEmitter$emitShared$lambda_10(group) {
612
+ return trimEnd(joinToString(group, '', VOID, VOID, VOID, VOID, RustIrEmitter$emitShared$lambda$lambda_5), charArrayOf([_Char___init__impl__6a9atx(10)]));
416
613
  }
417
- function _get_sanitizationConfig__sns434($this) {
418
- var tmp0 = $this.k1z_1;
419
- var tmp = KProperty1;
420
- // Inline function 'kotlin.getValue' call
421
- getPropertyCallableRef('sanitizationConfig', 1, tmp, RustIrEmitter$_get_sanitizationConfig_$ref_17ypni(), null);
422
- return tmp0.l1();
614
+ function RustIrEmitter$emitShared$lambda$lambda_5(it) {
615
+ return RustGenerator_instance.k1u(it);
423
616
  }
424
- function sanitize($this, _this__u8e3s4) {
425
- // Inline function 'kotlin.collections.mapIndexed' call
426
- var this_0 = split(_this__u8e3s4.l1(), ['.', ' ']);
427
- // Inline function 'kotlin.collections.mapIndexedTo' call
428
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
429
- var index = 0;
430
- var _iterator__ex2g4s = this_0.t();
431
- while (_iterator__ex2g4s.u()) {
432
- var item = _iterator__ex2g4s.v();
433
- var _unary__edvuaz = index;
434
- index = _unary__edvuaz + 1 | 0;
435
- var tmp$ret$0 = checkIndexOverflow(_unary__edvuaz) > 0 ? Companion_instance.oq(item) : item;
436
- destination.x(tmp$ret$0);
437
- }
438
- // Inline function 'kotlin.text.filter' call
439
- var tmp0 = joinToString(destination, '');
440
- // Inline function 'kotlin.text.filterTo' call
441
- var destination_0 = StringBuilder_init_$Create$();
442
- var inductionVariable = 0;
443
- var last = charSequenceLength(tmp0);
444
- if (inductionVariable < last)
445
- do {
446
- var index_0 = inductionVariable;
447
- inductionVariable = inductionVariable + 1 | 0;
448
- var element = charSequenceGet(tmp0, index_0);
449
- if (isLetterOrDigit(element) || element === _Char___init__impl__6a9atx(95)) {
450
- destination_0.s(element);
451
- }
452
- }
453
- while (inductionVariable < last);
454
- // Inline function 'kotlin.let' call
455
- var it = destination_0.toString();
456
- var tmp;
457
- var tmp0_safe_receiver = firstOrNull(it);
458
- var tmp_0;
459
- var tmp_1 = tmp0_safe_receiver;
460
- if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
461
- tmp_0 = null;
462
- } else {
463
- tmp_0 = isDigit(tmp0_safe_receiver);
464
- }
465
- if (tmp_0 === true) {
466
- tmp = '_' + it;
467
- } else {
468
- tmp = it;
469
- }
470
- // Inline function 'kotlin.let' call
471
- var it_0 = tmp;
472
- var tmp_2;
473
- if (_this__u8e3s4 instanceof FieldIdentifier) {
474
- tmp_2 = sanitizeKeywords($this, it_0);
475
- } else {
476
- tmp_2 = it_0;
477
- }
478
- var tmp$ret$9 = tmp_2;
479
- return toSnakeCase($this, tmp$ret$9);
617
+ function RustIrEmitter$emit$lambda(a, b) {
618
+ // Inline function 'kotlin.comparisons.compareValuesBy' call
619
+ var tmp = sortKey(a);
620
+ var tmp$ret$1 = sortKey(b);
621
+ return compareValues(tmp, tmp$ret$1);
480
622
  }
481
- function toSnakeCase($this, _this__u8e3s4) {
482
- return Companion_getInstance().m1h(_this__u8e3s4).y1l();
623
+ function emit$emitMod(this$0, def) {
624
+ return 'pub mod ' + sanitize(this$0, def.vq()) + ';';
483
625
  }
484
- function toPascalCase($this, _this__u8e3s4) {
485
- var tmp = split(_this__u8e3s4, ['_']);
486
- return joinToString(tmp, '', VOID, VOID, VOID, VOID, RustIrEmitter$toPascalCase$lambda);
626
+ function RustIrEmitter$emit$lambda_0(this$0) {
627
+ return function (it) {
628
+ return emit$emitMod(this$0, it);
629
+ };
487
630
  }
488
- function sanitizeKeywords($this, _this__u8e3s4) {
489
- return Companion_getInstance_0().o1z_1.u1(_this__u8e3s4) ? 'r#' + _this__u8e3s4 : _this__u8e3s4;
631
+ function RustIrEmitter$emit$lambda_1(this$0) {
632
+ return function (it) {
633
+ return emit$emitMod(this$0, it);
634
+ };
490
635
  }
491
- function sanitizeEnum($this, _this__u8e3s4) {
492
- // Inline function 'kotlin.let' call
493
- var it = toPascalCase($this, joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_'));
494
- var tmp;
495
- var tmp0_safe_receiver = firstOrNull(it);
496
- var tmp_0;
497
- var tmp_1 = tmp0_safe_receiver;
498
- if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
499
- tmp_0 = null;
500
- } else {
501
- tmp_0 = isDigit(tmp0_safe_receiver);
502
- }
503
- if (tmp_0 === true) {
504
- tmp = '_' + it;
505
- } else {
506
- tmp = it;
507
- }
508
- return tmp;
636
+ function RustIrEmitter$emit$lambda_2(this$0) {
637
+ return function (it) {
638
+ return sanitizeKeywords(this$0, sanitizeEnum(this$0, it));
639
+ };
509
640
  }
510
- function sort($this, definition) {
511
- var tmp;
512
- if (definition instanceof Enum_0) {
513
- tmp = 1;
514
- } else {
515
- if (definition instanceof Refined) {
516
- tmp = 2;
517
- } else {
518
- if (definition instanceof Type) {
519
- tmp = 3;
520
- } else {
521
- if (definition instanceof Union_0) {
522
- tmp = 4;
523
- } else {
524
- if (definition instanceof Endpoint) {
525
- tmp = 5;
526
- } else {
527
- if (definition instanceof Channel) {
528
- tmp = 6;
529
- } else {
530
- noWhenBranchMatchedException();
531
- }
532
- }
533
- }
534
- }
535
- }
536
- }
537
- return tmp;
641
+ function RustIrEmitter$emitClient$lambda(this$0) {
642
+ return function (endpoint) {
643
+ return 'pub mod ' + toSnakeCase(this$0, endpoint.ep_1.l1() + 'Client') + ';';
644
+ };
538
645
  }
539
- function prependImports($this, _this__u8e3s4, imports) {
646
+ function RustIrEmitter$toPascalCase$lambda(s) {
647
+ // Inline function 'kotlin.text.replaceFirstChar' call
540
648
  var tmp;
541
- // Inline function 'kotlin.collections.isNotEmpty' call
542
- if (!imports.r()) {
543
- tmp = _this__u8e3s4.x1m(VOID, plus(imports, _this__u8e3s4.u1m_1));
649
+ // Inline function 'kotlin.text.isNotEmpty' call
650
+ if (charSequenceLength(s) > 0) {
651
+ var it = charCodeAt(s, 0);
652
+ var tmp0 = uppercaseChar(it);
653
+ // Inline function 'kotlin.text.plus' call
654
+ var other = substring(s, 1);
655
+ tmp = toString(tmp0) + other;
544
656
  } else {
545
- tmp = _this__u8e3s4;
657
+ tmp = s;
546
658
  }
547
659
  return tmp;
548
660
  }
549
- function buildModelImports($this, _this__u8e3s4) {
550
- // Inline function 'kotlin.collections.distinctBy' call
551
- var this_0 = importReferences(_this__u8e3s4);
552
- var set = HashSet_init_$Create$();
553
- var list = ArrayList_init_$Create$();
554
- var _iterator__ex2g4s = this_0.t();
555
- while (_iterator__ex2g4s.u()) {
556
- var e = _iterator__ex2g4s.v();
557
- var key = e.lu_1;
558
- if (set.x(key)) {
559
- list.x(e);
560
- }
561
- }
562
- // Inline function 'kotlin.collections.map' call
563
- // Inline function 'kotlin.collections.mapTo' call
564
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
565
- var _iterator__ex2g4s_0 = list.t();
566
- while (_iterator__ex2g4s_0.u()) {
567
- var item = _iterator__ex2g4s_0.v();
568
- var tmp$ret$2 = import_0('super::' + toSnakeCase($this, item.lu_1), item.lu_1);
569
- destination.x(tmp$ret$2);
570
- }
571
- return destination;
661
+ function RustIrEmitter$buildClientParams$lambda(this$0) {
662
+ return function (_destruct__k2r9zo) {
663
+ var name = _destruct__k2r9zo.ne();
664
+ return sanitizeKeywords(this$0, name.x1l());
665
+ };
572
666
  }
573
- function buildEndpointImports($this, _this__u8e3s4) {
574
- // Inline function 'kotlin.collections.distinctBy' call
575
- var this_0 = importReferences(_this__u8e3s4);
576
- var set = HashSet_init_$Create$();
577
- var list = ArrayList_init_$Create$();
578
- var _iterator__ex2g4s = this_0.t();
579
- while (_iterator__ex2g4s.u()) {
580
- var e = _iterator__ex2g4s.v();
581
- var key = e.lu_1;
582
- if (set.x(key)) {
583
- list.x(e);
584
- }
585
- }
586
- // Inline function 'kotlin.collections.map' call
587
- // Inline function 'kotlin.collections.mapTo' call
588
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
589
- var _iterator__ex2g4s_0 = list.t();
590
- while (_iterator__ex2g4s_0.u()) {
591
- var item = _iterator__ex2g4s_0.v();
592
- var tmp$ret$2 = import_0('super::super::model::' + toSnakeCase($this, item.lu_1), item.lu_1);
593
- destination.x(tmp$ret$2);
594
- }
595
- return destination;
667
+ function RustIrEmitter$buildClientParams$lambda_0(this$0) {
668
+ return function (_destruct__k2r9zo) {
669
+ var name = _destruct__k2r9zo.ne();
670
+ var type = _destruct__k2r9zo.oe();
671
+ var tmp = sanitizeKeywords(this$0, name.x1l());
672
+ // Inline function 'kotlin.with' call
673
+ return tmp + ': ' + RustTransform_getInstance().j1y(type);
674
+ };
675
+ }
676
+ function RustIrEmitter(packageName, emitShared) {
677
+ Companion_getInstance_0();
678
+ packageName = packageName === VOID ? Companion_instance_0.lr('community.flock.wirespec.generated') : packageName;
679
+ emitShared = emitShared === VOID ? Companion_instance_1.go() : emitShared;
680
+ this.u1x_1 = packageName;
681
+ this.v1x_1 = emitShared;
682
+ this.w1x_1 = RustGenerator_instance;
683
+ this.x1x_1 = FileExtension_Rust_getInstance();
684
+ var tmp = this;
685
+ tmp.y1x_1 = lazy(RustIrEmitter$sanitizationConfig$delegate$lambda(this));
686
+ this.z1x_1 = listOf_0([import_0('super::super::wirespec', '*'), import_0('', 'regex')]);
687
+ this.a1y_1 = listOf_0([import_0('super::super::wirespec', '*'), import_0('', 'regex')]);
596
688
  }
597
- function injectSelfReceiver($this, _this__u8e3s4, fieldNames) {
689
+ protoOf(RustIrEmitter).j1u = function () {
690
+ return this.w1x_1;
691
+ };
692
+ protoOf(RustIrEmitter).eq = function () {
693
+ return this.x1x_1;
694
+ };
695
+ protoOf(RustIrEmitter).m1u = function () {
696
+ var rustImports = listOf_0([import_0('std::any', 'TypeId'), import_0('std::collections', 'HashMap')]);
697
+ var requestHeaders = interface_0('RequestHeaders', VOID, RustIrEmitter$emitShared$lambda);
698
+ var responseHeaders = interface_0('ResponseHeaders', VOID, RustIrEmitter$emitShared$lambda_0);
699
+ var client = new RawElement('pub trait Client {\n type Transport: Transportation;\n type Ser: Serialization;\n fn transport(&self) -> &Self::Transport;\n fn serialization(&self) -> &Self::Ser;\n}');
700
+ var server = new RawElement("pub trait Server {\n type Req;\n type Res;\n fn path_template(&self) -> &'static str;\n fn method(&self) -> Method;\n}");
701
+ var enumTrait = interface_0('Enum', VOID, RustIrEmitter$emitShared$lambda_1);
702
+ var refinedTrait = interface_0('Refined', VOID, RustIrEmitter$emitShared$lambda_2);
703
+ var requestTrait = interface_0('Request', VOID, RustIrEmitter$emitShared$lambda_3);
704
+ var responseTrait = interface_0('Response', VOID, RustIrEmitter$emitShared$lambda_4);
705
+ var rawElementInterfaces = mapOf([to('BodySerializer', new RawElement("pub trait BodySerializer {\n fn serialize_body<T: 'static>(&self, t: &T, r#type: TypeId) -> Vec<u8>;\n}")), to('BodyDeserializer', new RawElement("pub trait BodyDeserializer {\n fn deserialize_body<T: 'static>(&self, raw: &[u8], r#type: TypeId) -> T;\n}")), to('PathSerializer', new RawElement('pub trait PathSerializer {\n fn serialize_path<T: std::fmt::Display>(&self, t: &T, r#type: TypeId) -> String;\n}')), to('PathDeserializer', new RawElement('pub trait PathDeserializer {\n fn deserialize_path<T: std::str::FromStr>(&self, raw: &str, r#type: TypeId) -> T where T::Err: std::fmt::Debug;\n}')), to('ParamSerializer', new RawElement("pub trait ParamSerializer {\n fn serialize_param<T: 'static>(&self, value: &T, r#type: TypeId) -> Vec<String>;\n}")), to('ParamDeserializer', new RawElement("pub trait ParamDeserializer {\n fn deserialize_param<T: 'static>(&self, values: &[String], r#type: TypeId) -> T;\n}"))]);
706
+ var transportationTrait = interface_0('Transportation', VOID, RustIrEmitter$emitShared$lambda_5);
707
+ var dslTraits = mapOf([to('Enum', enumTrait), to('Refined', refinedTrait), to('Request', requestTrait), to('Response', responseTrait), to('Transportation', transportationTrait)]);
598
708
  // Inline function 'community.flock.wirespec.ir.core.transform' call
599
- var scope = new TransformScope(_this__u8e3s4);
709
+ var this_0 = convert(Companion_instance_0.lr('shared'));
710
+ var scope = new TransformScope(this_0);
600
711
  // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
601
712
  var tmp = scope;
602
713
  // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
603
- var this_0 = scope.z1t_1;
714
+ var this_1 = scope.w1t_1;
604
715
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
605
716
  // Inline function 'kotlin.apply' call
606
- var this_1 = new TransformerBuilder();
607
- this_1.d1h(RustIrEmitter$injectSelfReceiver$lambda(fieldNames));
608
- var tmp$ret$2 = this_1.e1h();
609
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
610
- var tmp_0 = scope.z1t_1;
611
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
612
- }
613
- function stripWirespecPrefix($this, _this__u8e3s4) {
614
- // Inline function 'community.flock.wirespec.ir.core.transform' call
615
- var scope = new TransformScope(_this__u8e3s4);
616
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matching' call
617
- var tmp = scope;
618
- // Inline function 'community.flock.wirespec.ir.core.transformMatching' call
619
- var this_0 = scope.z1t_1;
717
+ var this_2 = new TransformerBuilder();
718
+ this_2.c1h(RustIrEmitter$emitShared$lambda_6(rustImports));
719
+ var tmp$ret$2 = this_2.d1h();
720
+ tmp.w1t_1 = transform(this_1, tmp$ret$2);
721
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
722
+ var tmp_0 = scope;
723
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
724
+ var this_3 = scope.w1t_1;
620
725
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
621
726
  // Inline function 'kotlin.apply' call
622
- var this_1 = new TransformerBuilder();
623
- this_1.f1u(RustIrEmitter$stripWirespecPrefix$lambda);
624
- var tmp$ret$2 = this_1.e1h();
625
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
626
- var tmp_0 = scope.z1t_1;
627
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
628
- }
629
- function buildValidateFunction($this, refined) {
630
- var constraintExpr = convertConstraint(refined.cr_1, new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), Companion_getInstance().m1h('value')));
631
- return function_0('validate', VOID, VOID, RustIrEmitter$buildValidateFunction$lambda(constraintExpr));
632
- }
633
- function buildToStringFunction($this, refined) {
634
- var tmp;
635
- if (refined.cr_1.pu_1 instanceof String_1) {
636
- tmp = 'self.value.clone()';
637
- } else {
638
- tmp = 'format!("{}", self.value)';
639
- }
640
- var expr = tmp;
641
- return function_0('to_string', VOID, VOID, RustIrEmitter$buildToStringFunction$lambda(expr));
642
- }
643
- function buildClientParams($this, _this__u8e3s4) {
644
- var params = requestParameters(_this__u8e3s4);
645
- var tmp;
646
- // Inline function 'kotlin.collections.isNotEmpty' call
647
- if (!params.r()) {
648
- tmp = ', ' + joinToString(params, ', ', VOID, VOID, VOID, VOID, RustIrEmitter$buildClientParams$lambda($this));
649
- } else {
650
- tmp = '';
727
+ var this_4 = new TransformerBuilder();
728
+ this_4.c1h(RustIrEmitter$emitShared$lambda_7);
729
+ var tmp$ret$7 = this_4.d1h();
730
+ tmp_0.w1t_1 = transform(this_3, tmp$ret$7);
731
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
732
+ var tmp_1 = scope;
733
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
734
+ var this_5 = scope.w1t_1;
735
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
736
+ // Inline function 'kotlin.apply' call
737
+ var this_6 = new TransformerBuilder();
738
+ this_6.c1h(RustIrEmitter$emitShared$lambda_8(dslTraits, requestHeaders, responseHeaders, rawElementInterfaces, client, server));
739
+ var tmp$ret$12 = this_6.d1h();
740
+ tmp_1.w1t_1 = transform(this_5, tmp$ret$12);
741
+ var tmp_2 = scope.w1t_1;
742
+ // Inline function 'kotlin.let' call
743
+ var file = isInterface(tmp_2, Element) ? tmp_2 : THROW_CCE();
744
+ // Inline function 'kotlin.collections.flatMap' call
745
+ var tmp0 = file.s1m_1;
746
+ // Inline function 'kotlin.collections.flatMapTo' call
747
+ var destination = ArrayList_init_$Create$_0();
748
+ var _iterator__ex2g4s = tmp0.t();
749
+ while (_iterator__ex2g4s.u()) {
750
+ var element = _iterator__ex2g4s.v();
751
+ var tmp$ret$17;
752
+ $l$block: {
753
+ if (!(element instanceof Struct)) {
754
+ tmp$ret$17 = listOf(element);
755
+ break $l$block;
756
+ }
757
+ var derive;
758
+ switch (element.c1n_1.w1l()) {
759
+ case 'RawRequest':
760
+ case 'RawResponse':
761
+ derive = '#[derive(Debug, Clone, PartialEq)]';
762
+ break;
763
+ default:
764
+ derive = '#[derive(Debug, Clone, Default, PartialEq)]';
765
+ break;
766
+ }
767
+ tmp$ret$17 = listOf(new File(element.c1n_1, listOf_0([new RawElement(derive), element])));
768
+ }
769
+ var list = tmp$ret$17;
770
+ addAll(destination, list);
651
771
  }
652
- var paramsStr = tmp;
653
- var tmp_0;
654
- // Inline function 'kotlin.collections.isNotEmpty' call
655
- if (!params.r()) {
656
- tmp_0 = joinToString(params, ', ', VOID, VOID, VOID, VOID, RustIrEmitter$buildClientParams$lambda_0($this));
772
+ var tmp0_0 = new File(file.r1m_1, destination);
773
+ // Inline function 'kotlin.let' call
774
+ var wirespecFile = RustTransform_getInstance().k1y(tmp0_0);
775
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
776
+ var scope_0 = new TransformScope(wirespecFile);
777
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
778
+ var tmp_3 = scope_0;
779
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
780
+ var this_7 = scope_0.w1t_1;
781
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
782
+ // Inline function 'kotlin.apply' call
783
+ var this_8 = new TransformerBuilder();
784
+ this_8.c1h(RustIrEmitter$emitShared$lambda_9);
785
+ var tmp$ret$26 = this_8.d1h();
786
+ tmp_3.w1t_1 = transform(this_7, tmp$ret$26);
787
+ var tmp_4 = scope_0.w1t_1;
788
+ // Inline function 'kotlin.let' call
789
+ var tmp0_1 = (isInterface(tmp_4, Element) ? tmp_4 : THROW_CCE()).s1m_1;
790
+ // Inline function 'kotlin.collections.mutableListOf' call
791
+ // Inline function 'kotlin.collections.fold' call
792
+ var accumulator = ArrayList_init_$Create$_0();
793
+ var _iterator__ex2g4s_0 = tmp0_1.t();
794
+ while (_iterator__ex2g4s_0.u()) {
795
+ var element_0 = _iterator__ex2g4s_0.v();
796
+ var acc = accumulator;
797
+ var isImport = element_0 instanceof Import;
798
+ var tmp0_safe_receiver = lastOrNull(acc);
799
+ var tmp_5 = tmp0_safe_receiver == null ? null : firstOrNull_0(tmp0_safe_receiver);
800
+ var lastGroupIsImports = tmp_5 instanceof Import;
801
+ if (isImport && lastGroupIsImports)
802
+ last(acc).x(element_0);
803
+ else
804
+ acc.x(mutableListOf([element_0]));
805
+ accumulator = acc;
806
+ }
807
+ var groups = accumulator;
808
+ var source = joinToString(groups, '\n\n', VOID, VOID, VOID, VOID, RustIrEmitter$emitShared$lambda_10) + '\n';
809
+ var tmp_6;
810
+ if (this.v1x_1.ho_1) {
811
+ tmp_6 = new File(Companion_getInstance().l1h(this.u1x_1.or() + 'wirespec'), listOf(new RawElement(source)));
657
812
  } else {
658
- tmp_0 = '';
813
+ tmp_6 = null;
659
814
  }
660
- var argsStr = tmp_0;
661
- return to(paramsStr, argsStr);
662
- }
663
- function flattenForRust($this, _this__u8e3s4) {
664
- // Inline function 'community.flock.wirespec.ir.core.findElement' call
815
+ return tmp_6;
816
+ };
817
+ protoOf(RustIrEmitter).l1u = function (module_0, logger) {
818
+ // Inline function 'kotlin.collections.sortedBy' call
819
+ var this_0 = new NonEmptyList(module_0.dq_1);
820
+ // Inline function 'kotlin.comparisons.compareBy' call
821
+ var tmp = RustIrEmitter$emit$lambda;
822
+ var tmp$ret$0 = new sam$kotlin_Comparator$0(tmp);
823
+ var tmp$ret$1 = sortedWith(this_0, tmp$ret$0);
824
+ var tmp_0 = toNonEmptyListOrNull(tmp$ret$1);
825
+ var statements = ensureNotNull(tmp_0 == null ? null : new NonEmptyList(tmp_0)).yl_1;
826
+ // Inline function 'kotlin.let' call
827
+ var files = emit.call(this, module_0.vu(VOID, statements), logger);
665
828
  // Inline function 'kotlin.collections.filterIsInstance' call
666
- var tmp0 = _this__u8e3s4.v1m();
829
+ var tmp0 = new NonEmptyList(module_0.dq_1);
667
830
  // Inline function 'kotlin.collections.filterIsInstanceTo' call
668
- var destination = ArrayList_init_$Create$();
831
+ var destination = ArrayList_init_$Create$_0();
669
832
  var _iterator__ex2g4s = tmp0.t();
670
833
  while (_iterator__ex2g4s.u()) {
671
834
  var element = _iterator__ex2g4s.v();
672
- if (element instanceof Namespace) {
835
+ if (element instanceof Endpoint) {
673
836
  destination.x(element);
674
837
  }
675
838
  }
676
- var tmp$ret$2 = firstOrNull_0(destination);
677
- var namespace = ensureNotNull(tmp$ret$2);
678
- var flattened = flattenNestedStructs(namespace);
679
- // Inline function 'kotlin.collections.filter' call
680
- var tmp0_0 = flattened.a1n_1;
681
- // Inline function 'kotlin.collections.filterTo' call
682
- var destination_0 = ArrayList_init_$Create$();
839
+ var endpoints = destination;
840
+ var endpointMods = joinToString(endpoints, '\n', VOID, VOID, VOID, VOID, RustIrEmitter$emit$lambda_0(this));
841
+ var tmp_1;
842
+ // Inline function 'kotlin.collections.isNotEmpty' call
843
+ if (!endpoints.r()) {
844
+ tmp_1 = '\npub mod client;';
845
+ } else {
846
+ tmp_1 = '';
847
+ }
848
+ var clientMod = tmp_1;
849
+ var modRs = new File(Companion_getInstance().l1h(this.u1x_1.or() + 'mod'), listOf(new RawElement('#![allow(warnings)]\npub mod model;\npub mod endpoint;' + clientMod + '\npub mod wirespec;')));
850
+ var modEndpoint = new File(Companion_getInstance().l1h(this.u1x_1.or() + 'endpoint/' + 'mod'), listOf(new RawElement(endpointMods)));
851
+ var tmp_2 = Companion_getInstance().l1h(this.u1x_1.or() + 'model/' + 'mod');
852
+ // Inline function 'kotlin.collections.filterIsInstance' call
853
+ var tmp0_0 = new NonEmptyList(module_0.dq_1);
854
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
855
+ var destination_0 = ArrayList_init_$Create$_0();
683
856
  var _iterator__ex2g4s_0 = tmp0_0.t();
684
857
  while (_iterator__ex2g4s_0.u()) {
685
858
  var element_0 = _iterator__ex2g4s_0.v();
686
- var tmp;
687
- if (element_0 instanceof Struct) {
688
- tmp = true;
689
- } else {
690
- tmp = element_0 instanceof Union;
691
- }
692
- if (tmp) {
859
+ if (!(element_0 == null) ? isInterface(element_0, Model) : false) {
693
860
  destination_0.x(element_0);
694
861
  }
695
862
  }
696
- // Inline function 'kotlin.collections.map' call
697
- // Inline function 'kotlin.collections.mapTo' call
698
- var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_0, 10));
699
- var _iterator__ex2g4s_1 = destination_0.t();
700
- while (_iterator__ex2g4s_1.u()) {
701
- var item = _iterator__ex2g4s_1.v();
702
- var tmp_0;
863
+ var tmp_3 = destination_0;
864
+ var modModel = new File(tmp_2, listOf(new RawElement(joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, RustIrEmitter$emit$lambda_1(this)))));
865
+ return this.v1x_1.ho_1 ? NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(files, modRs), modEndpoint), modModel) : NonEmptyList__plus_impl_xqmb9(files, modRs);
866
+ };
867
+ protoOf(RustIrEmitter).uq = function (definition, module_0, logger) {
868
+ var subPackageName = plus_1(this.u1x_1, definition);
869
+ var tmp;
870
+ if (definition instanceof Endpoint) {
871
+ tmp = this.a1y_1;
872
+ } else {
873
+ tmp = this.z1x_1;
874
+ }
875
+ var importHeader = tmp;
876
+ var tmp0 = emit_0.call(this, definition, module_0, logger);
877
+ // Inline function 'kotlin.let' call
878
+ var file = RustTransform_getInstance().k1y(tmp0);
879
+ var tmp_0 = Companion_getInstance().l1h(subPackageName.or() + toSnakeCase(this, file.r1m_1.w1l()));
880
+ // Inline function 'kotlin.collections.flatMap' call
881
+ var tmp0_0 = file.s1m_1;
882
+ // Inline function 'kotlin.collections.flatMapTo' call
883
+ var destination = ArrayList_init_$Create$_0();
884
+ var _iterator__ex2g4s = tmp0_0.t();
885
+ while (_iterator__ex2g4s.u()) {
886
+ var element = _iterator__ex2g4s.v();
703
887
  var tmp_1;
704
- if (item instanceof Union) {
705
- tmp_1 = item.d1q_1.x1l() === 'Response';
888
+ if (element instanceof Struct) {
889
+ tmp_1 = listOf_0([new RawElement('#[derive(Debug, Clone, Default, PartialEq)]'), element]);
706
890
  } else {
707
- tmp_1 = false;
891
+ tmp_1 = listOf(element);
708
892
  }
709
- if (tmp_1) {
710
- // Inline function 'kotlin.collections.filterIsInstance' call
711
- var tmp0_1 = flattened.a1n_1;
712
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
713
- var destination_2 = ArrayList_init_$Create$();
714
- var _iterator__ex2g4s_2 = tmp0_1.t();
715
- while (_iterator__ex2g4s_2.u()) {
716
- var element_1 = _iterator__ex2g4s_2.v();
717
- if (element_1 instanceof Struct) {
718
- destination_2.x(element_1);
719
- }
893
+ var list = tmp_1;
894
+ addAll(destination, list);
895
+ }
896
+ return new File(tmp_0, plus(importHeader, destination));
897
+ };
898
+ protoOf(RustIrEmitter).up = function (type, module_0) {
899
+ var tmp = convertWithValidation(type, module_0);
900
+ // Inline function 'kotlin.collections.map' call
901
+ var this_0 = type.wo_1.so_1;
902
+ // Inline function 'kotlin.collections.mapTo' call
903
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
904
+ var _iterator__ex2g4s = this_0.t();
905
+ while (_iterator__ex2g4s.u()) {
906
+ var item = _iterator__ex2g4s.v();
907
+ var tmp$ret$0 = item.ap_1.l1();
908
+ destination.x(tmp$ret$0);
909
+ }
910
+ return prependImports(this, sanitizeNames(injectSelfReceiverToValidate(tmp, toSet(destination), '&self'), _get_sanitizationConfig__sns434(this)), buildModelImports(type));
911
+ };
912
+ protoOf(RustIrEmitter).ir = function (enum_0, module_0) {
913
+ var tmp = convert_0(enum_0);
914
+ return sanitizeEnumEntries(tmp, RustIrEmitter$emit$lambda_2(this));
915
+ };
916
+ protoOf(RustIrEmitter).yq = function (union) {
917
+ return convert_1(union);
918
+ };
919
+ protoOf(RustIrEmitter).dr = function (refined) {
920
+ return replaceStructWithRefinedFunctions(convert_2(refined), refined);
921
+ };
922
+ protoOf(RustIrEmitter).jr = function (endpoint) {
923
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
924
+ var this_0 = stripResponseGenerics(stripHandlerExtends(convertSimpleRawExpressionsToVariableRefs(stripWirespecPrefix(flattenForRust(convert_3(endpoint))))));
925
+ var scope = new TransformScope(this_0);
926
+ scope.b1u(fixResponseSwitchPatterns());
927
+ var tmp = scope.w1t_1;
928
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
929
+ var this_1 = isInterface(tmp, Element) ? tmp : THROW_CCE();
930
+ var scope_0 = new TransformScope(this_1);
931
+ scope_0.b1u(fixConstructorCalls());
932
+ var tmp_0 = scope_0.w1t_1;
933
+ var tmp$ret$3 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
934
+ return prependImports(this, sanitizeNames(injectApiStruct(injectResponseFromImpls(injectHandlerImplForClient(injectSelfToHandlerMethods(tmp$ret$3), endpoint)), endpoint), _get_sanitizationConfig__sns434(this)), buildEndpointImports(endpoint));
935
+ };
936
+ protoOf(RustIrEmitter).xq = function (channel) {
937
+ return convert_4(channel);
938
+ };
939
+ protoOf(RustIrEmitter).o1u = function (endpoint) {
940
+ var endpointName = endpoint.ep_1.l1();
941
+ var endpointModuleName = toSnakeCase(this, endpointName);
942
+ var clientName = endpointName + 'Client';
943
+ var methodName = toSnakeCase(this, endpointName);
944
+ var _destruct__k2r9zo = buildClientParams(this, endpoint);
945
+ var paramsStr = _destruct__k2r9zo.ne();
946
+ var requestArgs = _destruct__k2r9zo.oe();
947
+ var requestConstruction = endpointModuleName + '::Request::new(' + requestArgs + ')';
948
+ // Inline function 'kotlin.collections.distinctBy' call
949
+ var this_0 = importReferences(endpoint);
950
+ var set = HashSet_init_$Create$();
951
+ var list = ArrayList_init_$Create$_0();
952
+ var _iterator__ex2g4s = this_0.t();
953
+ while (_iterator__ex2g4s.u()) {
954
+ var e = _iterator__ex2g4s.v();
955
+ var key = e.ku_1;
956
+ if (set.x(key)) {
957
+ list.x(e);
958
+ }
959
+ }
960
+ // Inline function 'kotlin.collections.map' call
961
+ // Inline function 'kotlin.collections.mapTo' call
962
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(list, 10));
963
+ var _iterator__ex2g4s_0 = list.t();
964
+ while (_iterator__ex2g4s_0.u()) {
965
+ var item = _iterator__ex2g4s_0.v();
966
+ var tmp$ret$2 = import_0('super::super::model::' + toSnakeCase(this, item.ku_1), item.ku_1);
967
+ destination.x(tmp$ret$2);
968
+ }
969
+ var modelImports = destination;
970
+ var namespacePath = endpointModuleName + '::' + endpointName;
971
+ // Inline function 'kotlin.collections.buildList' call
972
+ // Inline function 'kotlin.collections.buildListInternal' call
973
+ // Inline function 'kotlin.apply' call
974
+ var this_1 = ArrayList_init_$Create$_0();
975
+ this_1.x('pub struct ' + clientName + "<'a, S: Serialization, T: Transportation> {");
976
+ this_1.x(" pub serialization: &'a S,");
977
+ this_1.x(" pub transportation: &'a T,");
978
+ this_1.x('}');
979
+ this_1.x("impl<'a, S: Serialization, T: Transportation> " + namespacePath + '::Call for ' + clientName + "<'a, S, T> {");
980
+ this_1.x(' async fn ' + methodName + '(&self' + paramsStr + ') -> ' + endpointModuleName + '::Response {');
981
+ this_1.x(' let request = ' + requestConstruction + ';');
982
+ this_1.x(' let raw_request = ' + namespacePath + '::to_raw_request(self.serialization, request);');
983
+ this_1.x(' let raw_response = self.transportation.transport(&raw_request).await;');
984
+ this_1.x(' ' + namespacePath + '::from_raw_response(self.serialization, raw_response)');
985
+ this_1.x(' }');
986
+ this_1.x('}');
987
+ var tmp$ret$8 = this_1.o5();
988
+ var code = joinToString(tmp$ret$8, '\n');
989
+ var subPackageName = plus_2(this.u1x_1, 'client');
990
+ var tmp = Companion_getInstance().l1h(subPackageName.or() + toSnakeCase(this, clientName));
991
+ // Inline function 'kotlin.collections.buildList' call
992
+ // Inline function 'kotlin.collections.buildListInternal' call
993
+ // Inline function 'kotlin.apply' call
994
+ var this_2 = ArrayList_init_$Create$_0();
995
+ this_2.x(import_0('super::super::wirespec', '*'));
996
+ this_2.x(import_0('super::super::endpoint', endpointModuleName));
997
+ this_2.e1(modelImports);
998
+ this_2.x(new RawElement(code));
999
+ var tmp$ret$12 = this_2.o5();
1000
+ return new File(tmp, tmp$ret$12);
1001
+ };
1002
+ protoOf(RustIrEmitter).n1u = function (endpoints, logger) {
1003
+ logger.sq('Emitting main Client for ' + endpoints.a1() + ' endpoints');
1004
+ var modDeclarations = joinToString(endpoints, '\n', VOID, VOID, VOID, VOID, RustIrEmitter$emitClient$lambda(this));
1005
+ // Inline function 'kotlin.collections.flatMap' call
1006
+ // Inline function 'kotlin.collections.flatMapTo' call
1007
+ var destination = ArrayList_init_$Create$_0();
1008
+ var _iterator__ex2g4s = endpoints.t();
1009
+ while (_iterator__ex2g4s.u()) {
1010
+ var element = _iterator__ex2g4s.v();
1011
+ var list = importReferences(element);
1012
+ addAll(destination, list);
1013
+ }
1014
+ // Inline function 'kotlin.collections.distinctBy' call
1015
+ var set = HashSet_init_$Create$();
1016
+ var list_0 = ArrayList_init_$Create$_0();
1017
+ var _iterator__ex2g4s_0 = destination.t();
1018
+ while (_iterator__ex2g4s_0.u()) {
1019
+ var e = _iterator__ex2g4s_0.v();
1020
+ var key = e.ku_1;
1021
+ if (set.x(key)) {
1022
+ list_0.x(e);
1023
+ }
1024
+ }
1025
+ // Inline function 'kotlin.collections.filter' call
1026
+ // Inline function 'kotlin.collections.filterTo' call
1027
+ var destination_0 = ArrayList_init_$Create$_0();
1028
+ var _iterator__ex2g4s_1 = list_0.t();
1029
+ while (_iterator__ex2g4s_1.u()) {
1030
+ var element_0 = _iterator__ex2g4s_1.v();
1031
+ var tmp$ret$5;
1032
+ $l$block_0: {
1033
+ // Inline function 'kotlin.collections.none' call
1034
+ var tmp;
1035
+ if (isInterface(endpoints, Collection)) {
1036
+ tmp = endpoints.r();
1037
+ } else {
1038
+ tmp = false;
720
1039
  }
721
- // Inline function 'kotlin.collections.map' call
722
- // Inline function 'kotlin.collections.mapTo' call
723
- var destination_3 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_2, 10));
724
- var _iterator__ex2g4s_3 = destination_2.t();
725
- while (_iterator__ex2g4s_3.u()) {
726
- var item_0 = _iterator__ex2g4s_3.v();
727
- var tmp$ret$8 = item_0.f1n_1.x1l();
728
- destination_3.x(tmp$ret$8);
1040
+ if (tmp) {
1041
+ tmp$ret$5 = true;
1042
+ break $l$block_0;
729
1043
  }
730
- // Inline function 'kotlin.collections.filter' call
731
- // Inline function 'kotlin.collections.filterTo' call
732
- var destination_4 = ArrayList_init_$Create$();
733
- var _iterator__ex2g4s_4 = destination_3.t();
734
- while (_iterator__ex2g4s_4.u()) {
735
- var element_2 = _iterator__ex2g4s_4.v();
736
- if (get_RESPONSE_PATTERN().nc(element_2)) {
737
- destination_4.x(element_2);
1044
+ var _iterator__ex2g4s_2 = endpoints.t();
1045
+ while (_iterator__ex2g4s_2.u()) {
1046
+ var element_1 = _iterator__ex2g4s_2.v();
1047
+ if (element_1.ep_1.l1() === element_0.ku_1) {
1048
+ tmp$ret$5 = false;
1049
+ break $l$block_0;
738
1050
  }
739
1051
  }
740
- // Inline function 'kotlin.collections.map' call
741
- // Inline function 'kotlin.collections.mapTo' call
742
- var destination_5 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_4, 10));
743
- var _iterator__ex2g4s_5 = destination_4.t();
744
- while (_iterator__ex2g4s_5.u()) {
745
- var item_1 = _iterator__ex2g4s_5.v();
746
- var tmp$ret$14 = new Custom(item_1);
747
- destination_5.x(tmp$ret$14);
748
- }
749
- var members = destination_5;
750
- tmp_0 = item.i1q(VOID, VOID, members, emptyList());
751
- } else {
752
- if (item instanceof Union) {
753
- tmp_0 = item.i1q(VOID, VOID, VOID, emptyList());
754
- } else {
755
- tmp_0 = item;
756
- }
757
- }
758
- var tmp$ret$17 = tmp_0;
759
- destination_1.x(tmp$ret$17);
760
- }
761
- var moduleElements = destination_1;
762
- // Inline function 'kotlin.collections.filterNot' call
763
- var tmp0_2 = flattened.a1n_1;
764
- // Inline function 'kotlin.collections.filterNotTo' call
765
- var destination_6 = ArrayList_init_$Create$();
766
- var _iterator__ex2g4s_6 = tmp0_2.t();
767
- while (_iterator__ex2g4s_6.u()) {
768
- var element_3 = _iterator__ex2g4s_6.v();
769
- var tmp_2;
770
- if (element_3 instanceof Struct) {
771
- tmp_2 = true;
772
- } else {
773
- tmp_2 = element_3 instanceof Union;
1052
+ tmp$ret$5 = true;
774
1053
  }
775
- if (!tmp_2) {
776
- destination_6.x(element_3);
1054
+ if (tmp$ret$5) {
1055
+ destination_0.x(element_0);
777
1056
  }
778
1057
  }
779
- var classElements = destination_6;
780
- return new File(namespace.z1m_1, plus_0(moduleElements, new Namespace(namespace.z1m_1, classElements, namespace.b1n_1)));
781
- }
782
- function fixResponseSwitchPatterns($this) {
783
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1058
+ // Inline function 'kotlin.collections.map' call
1059
+ // Inline function 'kotlin.collections.mapTo' call
1060
+ var destination_1 = ArrayList_init_$Create$(collectionSizeOrDefault(destination_0, 10));
1061
+ var _iterator__ex2g4s_3 = destination_0.t();
1062
+ while (_iterator__ex2g4s_3.u()) {
1063
+ var item = _iterator__ex2g4s_3.v();
1064
+ var tmp$ret$10 = import_0('super::model::' + toSnakeCase(this, item.ku_1), item.ku_1);
1065
+ destination_1.x(tmp$ret$10);
1066
+ }
1067
+ var modelImports = destination_1;
1068
+ // Inline function 'kotlin.collections.flatMap' call
1069
+ // Inline function 'kotlin.collections.flatMapTo' call
1070
+ var destination_2 = ArrayList_init_$Create$_0();
1071
+ var _iterator__ex2g4s_4 = endpoints.t();
1072
+ while (_iterator__ex2g4s_4.u()) {
1073
+ var element_2 = _iterator__ex2g4s_4.v();
1074
+ var endpointModuleName = toSnakeCase(this, element_2.ep_1.l1());
1075
+ var clientModuleName = toSnakeCase(this, element_2.ep_1.l1() + 'Client');
1076
+ var list_1 = listOf_0([import_0('super::endpoint', endpointModuleName), import_0(clientModuleName, element_2.ep_1.l1() + 'Client')]);
1077
+ addAll(destination_2, list_1);
1078
+ }
1079
+ var endpointAndClientImports = destination_2;
1080
+ // Inline function 'kotlin.collections.flatMap' call
1081
+ // Inline function 'kotlin.collections.flatMapTo' call
1082
+ var destination_3 = ArrayList_init_$Create$_0();
1083
+ var _iterator__ex2g4s_5 = endpoints.t();
1084
+ while (_iterator__ex2g4s_5.u()) {
1085
+ var element_3 = _iterator__ex2g4s_5.v();
1086
+ var endpointName = element_3.ep_1.l1();
1087
+ var endpointModuleName_0 = toSnakeCase(this, endpointName);
1088
+ var namespacePath = endpointModuleName_0 + '::' + endpointName;
1089
+ var methodName = toSnakeCase(this, endpointName);
1090
+ var _destruct__k2r9zo = buildClientParams(this, element_3);
1091
+ var paramsStr = _destruct__k2r9zo.ne();
1092
+ var callArgs = _destruct__k2r9zo.oe();
1093
+ var delegateCall = endpointName + 'Client { serialization: &self.serialization, transportation: &self.transportation }\n' + (' .' + methodName + '(' + callArgs + ').await');
1094
+ var list_2 = listOf_0(['impl<S: Serialization, T: Transportation> ' + namespacePath + '::Call for Client<S, T> {', ' async fn ' + methodName + '(&self' + paramsStr + ') -> ' + endpointModuleName_0 + '::Response {', ' ' + delegateCall, ' }', '}']);
1095
+ addAll(destination_3, list_2);
1096
+ }
1097
+ var implBlocks = destination_3;
1098
+ var code = joinToString(plus(listOf_0(['pub struct Client<S: Serialization, T: Transportation> {', ' pub serialization: S,', ' pub transportation: T,', '}']), implBlocks), '\n');
1099
+ var tmp_0 = Companion_getInstance().l1h(this.u1x_1.or() + 'client');
1100
+ // Inline function 'kotlin.collections.buildList' call
1101
+ // Inline function 'kotlin.collections.buildListInternal' call
784
1102
  // Inline function 'kotlin.apply' call
785
- var this_0 = new TransformerBuilder();
786
- this_0.g1u(RustIrEmitter$fixResponseSwitchPatterns$lambda);
787
- return this_0.e1h();
788
- }
789
- function fixConstructorCalls($this) {
1103
+ var this_0 = ArrayList_init_$Create$_0();
1104
+ this_0.x(new RawElement(modDeclarations));
1105
+ this_0.x(import_0('super::wirespec', '*'));
1106
+ this_0.e1(modelImports);
1107
+ this_0.e1(endpointAndClientImports);
1108
+ this_0.x(new RawElement(code));
1109
+ var tmp$ret$22 = this_0.o5();
1110
+ return new File(tmp_0, tmp$ret$22);
1111
+ };
1112
+ function get_rustSelfParam() {
1113
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1114
+ return rustSelfParam;
1115
+ }
1116
+ var rustSelfParam;
1117
+ function get_rustResponsePattern() {
1118
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1119
+ return rustResponsePattern;
1120
+ }
1121
+ var rustResponsePattern;
1122
+ function fixResponseSwitchPatterns() {
1123
+ _init_properties_RustIrTransformer_kt__rrvmwq();
790
1124
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
791
1125
  // Inline function 'kotlin.apply' call
792
1126
  var this_0 = new TransformerBuilder();
793
- this_0.i1u(RustIrEmitter$fixConstructorCalls$lambda);
794
- return this_0.e1h();
1127
+ this_0.d1u(fixResponseSwitchPatterns$lambda);
1128
+ return this_0.d1h();
1129
+ }
1130
+ function buildModelImports(_this__u8e3s4) {
1131
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1132
+ // Inline function 'kotlin.collections.distinctBy' call
1133
+ var this_0 = importReferences(_this__u8e3s4);
1134
+ var set = HashSet_init_$Create$();
1135
+ var list = ArrayList_init_$Create$_0();
1136
+ var _iterator__ex2g4s = this_0.t();
1137
+ while (_iterator__ex2g4s.u()) {
1138
+ var e = _iterator__ex2g4s.v();
1139
+ var key = e.ku_1;
1140
+ if (set.x(key)) {
1141
+ list.x(e);
1142
+ }
1143
+ }
1144
+ // Inline function 'kotlin.collections.map' call
1145
+ // Inline function 'kotlin.collections.mapTo' call
1146
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(list, 10));
1147
+ var _iterator__ex2g4s_0 = list.t();
1148
+ while (_iterator__ex2g4s_0.u()) {
1149
+ var item = _iterator__ex2g4s_0.v();
1150
+ var tmp$ret$2 = import_0('super::' + toRustSnakeCase(item.ku_1), item.ku_1);
1151
+ destination.x(tmp$ret$2);
1152
+ }
1153
+ return destination;
795
1154
  }
796
- function stripHandlerExtends($this, _this__u8e3s4) {
1155
+ function replaceStructWithRefinedFunctions(_this__u8e3s4, refined) {
1156
+ _init_properties_RustIrTransformer_kt__rrvmwq();
797
1157
  // Inline function 'community.flock.wirespec.ir.core.transform' call
798
1158
  var scope = new TransformScope(_this__u8e3s4);
799
1159
  // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
800
1160
  var tmp = scope;
801
1161
  // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
802
- var this_0 = scope.z1t_1;
1162
+ var this_0 = scope.w1t_1;
803
1163
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
804
1164
  // Inline function 'kotlin.apply' call
805
1165
  var this_1 = new TransformerBuilder();
806
- this_1.d1h(RustIrEmitter$stripHandlerExtends$lambda);
807
- var tmp$ret$2 = this_1.e1h();
808
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
809
- var tmp_0 = scope.z1t_1;
1166
+ this_1.c1h(replaceStructWithRefinedFunctions$lambda(refined));
1167
+ var tmp$ret$2 = this_1.d1h();
1168
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1169
+ var tmp_0 = scope.w1t_1;
810
1170
  return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
811
1171
  }
812
- function stripResponseGenerics($this, _this__u8e3s4) {
1172
+ function injectApiStruct(_this__u8e3s4, endpoint) {
1173
+ _init_properties_RustIrTransformer_kt__rrvmwq();
813
1174
  // Inline function 'community.flock.wirespec.ir.core.transform' call
814
1175
  var scope = new TransformScope(_this__u8e3s4);
815
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matching' call
1176
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
816
1177
  var tmp = scope;
817
- // Inline function 'community.flock.wirespec.ir.core.transformMatching' call
818
- var this_0 = scope.z1t_1;
1178
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1179
+ var this_0 = scope.w1t_1;
819
1180
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
820
1181
  // Inline function 'kotlin.apply' call
821
1182
  var this_1 = new TransformerBuilder();
822
- this_1.f1u(RustIrEmitter$stripResponseGenerics$lambda);
823
- var tmp$ret$2 = this_1.e1h();
824
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
825
- var tmp_0 = scope.z1t_1;
1183
+ this_1.c1h(injectApiStruct$lambda(endpoint));
1184
+ var tmp$ret$2 = this_1.d1h();
1185
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1186
+ var tmp_0 = scope.w1t_1;
826
1187
  return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
827
1188
  }
828
- function injectSelfToHandlerMethods($this, _this__u8e3s4) {
1189
+ function injectResponseFromImpls(_this__u8e3s4) {
1190
+ _init_properties_RustIrTransformer_kt__rrvmwq();
829
1191
  // Inline function 'community.flock.wirespec.ir.core.transform' call
830
1192
  var scope = new TransformScope(_this__u8e3s4);
831
1193
  // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
832
1194
  var tmp = scope;
833
1195
  // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
834
- var this_0 = scope.z1t_1;
1196
+ var this_0 = scope.w1t_1;
835
1197
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
836
1198
  // Inline function 'kotlin.apply' call
837
1199
  var this_1 = new TransformerBuilder();
838
- this_1.d1h(RustIrEmitter$injectSelfToHandlerMethods$lambda);
839
- var tmp$ret$2 = this_1.e1h();
840
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
841
- var tmp_0 = scope.z1t_1;
1200
+ this_1.c1h(injectResponseFromImpls$lambda);
1201
+ var tmp$ret$2 = this_1.d1h();
1202
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1203
+ var tmp_0 = scope.w1t_1;
842
1204
  return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
843
1205
  }
844
- function injectHandlerImplForClient($this, _this__u8e3s4, endpoint) {
1206
+ function injectHandlerImplForClient(_this__u8e3s4, endpoint) {
1207
+ _init_properties_RustIrTransformer_kt__rrvmwq();
845
1208
  // Inline function 'community.flock.wirespec.ir.core.transform' call
846
1209
  var scope = new TransformScope(_this__u8e3s4);
847
1210
  // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
848
1211
  var tmp = scope;
849
1212
  // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
850
- var this_0 = scope.z1t_1;
1213
+ var this_0 = scope.w1t_1;
851
1214
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
852
1215
  // Inline function 'kotlin.apply' call
853
1216
  var this_1 = new TransformerBuilder();
854
- this_1.d1h(RustIrEmitter$injectHandlerImplForClient$lambda);
855
- var tmp$ret$2 = this_1.e1h();
856
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
857
- var tmp_0 = scope.z1t_1;
1217
+ this_1.c1h(injectHandlerImplForClient$lambda);
1218
+ var tmp$ret$2 = this_1.d1h();
1219
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1220
+ var tmp_0 = scope.w1t_1;
858
1221
  return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
859
1222
  }
860
- function injectResponseFromImpls($this, _this__u8e3s4) {
1223
+ function injectSelfToHandlerMethods(_this__u8e3s4) {
1224
+ _init_properties_RustIrTransformer_kt__rrvmwq();
861
1225
  // Inline function 'community.flock.wirespec.ir.core.transform' call
862
1226
  var scope = new TransformScope(_this__u8e3s4);
863
1227
  // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
864
1228
  var tmp = scope;
865
1229
  // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
866
- var this_0 = scope.z1t_1;
1230
+ var this_0 = scope.w1t_1;
867
1231
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
868
1232
  // Inline function 'kotlin.apply' call
869
1233
  var this_1 = new TransformerBuilder();
870
- this_1.d1h(RustIrEmitter$injectResponseFromImpls$lambda);
871
- var tmp$ret$2 = this_1.e1h();
872
- tmp.z1t_1 = transform(this_0, tmp$ret$2);
873
- var tmp_0 = scope.z1t_1;
1234
+ this_1.c1h(injectSelfToHandlerMethods$lambda);
1235
+ var tmp$ret$2 = this_1.d1h();
1236
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1237
+ var tmp_0 = scope.w1t_1;
874
1238
  return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
875
1239
  }
876
- function buildApiStruct($this, endpoint) {
877
- return new RawElement(generateApiStruct($this, endpoint));
878
- }
879
- function generateApiStruct($this, _this__u8e3s4) {
880
- // Inline function 'kotlin.let' call
881
- var pathTemplate = '/' + joinToString(_this__u8e3s4.gp_1, '/', VOID, VOID, VOID, VOID, RustIrEmitter$generateApiStruct$lambda);
882
- var methodName = _this__u8e3s4.fp_1.a3_1;
883
- return trimIndent('\n pub struct Api;\n impl Server for Api {\n type Req = Request;\n type Res = Response;\n fn path_template(&self) -> &\'static str { "' + pathTemplate + '" }\n fn method(&self) -> Method { Method::' + methodName + ' }\n }\n ');
884
- }
885
- function Companion() {
886
- Companion_instance_2 = this;
887
- this.o1z_1 = setOf(['as', 'break', 'const', 'continue', 'crate', 'else', 'enum', 'extern', 'false', 'fn', 'for', 'if', 'impl', 'in', 'let', 'loop', 'match', 'mod', 'move', 'mut', 'pub', 'ref', 'return', 'self', 'Self', 'static', 'struct', 'super', 'trait', 'true', 'type', 'unsafe', 'use', 'where', 'while', 'async', 'await', 'dyn', 'abstract', 'become', 'box', 'do', 'final', 'macro', 'override', 'priv', 'typeof', 'unsized', 'virtual', 'yield', 'try']);
888
- }
889
- var Companion_instance_2;
890
- function Companion_getInstance_0() {
891
- if (Companion_instance_2 == null)
892
- new Companion();
893
- return Companion_instance_2;
894
- }
895
- function sam$kotlin_Comparator$0(function_0) {
896
- this.p1z_1 = function_0;
897
- }
898
- protoOf(sam$kotlin_Comparator$0).qd = function (a, b) {
899
- return this.p1z_1(a, b);
900
- };
901
- protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
902
- return this.qd(a, b);
903
- };
904
- protoOf(sam$kotlin_Comparator$0).l3 = function () {
905
- return this.p1z_1;
906
- };
907
- protoOf(sam$kotlin_Comparator$0).equals = function (other) {
908
- var tmp;
909
- if (!(other == null) ? isInterface(other, Comparator) : false) {
910
- var tmp_0;
911
- if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
912
- tmp_0 = equals(this.l3(), other.l3());
913
- } else {
914
- tmp_0 = false;
915
- }
916
- tmp = tmp_0;
917
- } else {
918
- tmp = false;
919
- }
920
- return tmp;
921
- };
922
- protoOf(sam$kotlin_Comparator$0).hashCode = function () {
923
- return hashCode(this.l3());
924
- };
925
- function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
926
- return 'r#' + it;
927
- }
928
- function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(name) {
929
- return Companion_getInstance().m1h((new Name(name.n1h_1)).y1l());
930
- }
931
- function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(name) {
932
- var value = name.s1h();
933
- switch (value) {
934
- case 'self':
935
- case '&self':
936
- return name;
937
- default:
938
- return Companion_getInstance().m1h((new Name(name.n1h_1)).y1l());
939
- }
940
- }
941
- function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(it) {
942
- return it;
943
- }
944
- function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
945
- return function (stmt, tr) {
946
- var tmp;
947
- if (stmt instanceof ConstructorStatement) {
948
- var tmp_0 = tr.r1t(stmt.p1m_1);
949
- // Inline function 'kotlin.collections.map' call
950
- var this_0 = stmt.q1m_1;
951
- // Inline function 'kotlin.collections.mapTo' call
952
- var destination = ArrayList_init_$Create$_0(this_0.a1());
953
- // Inline function 'kotlin.collections.iterator' call
954
- var _iterator__ex2g4s = this_0.j1().t();
955
- while (_iterator__ex2g4s.u()) {
956
- var item = _iterator__ex2g4s.v();
957
- // Inline function 'kotlin.collections.component1' call
958
- var k = item.k1();
959
- // Inline function 'kotlin.collections.component2' call
960
- var v = item.l1();
961
- var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), k), tr.u1t(v));
962
- destination.x(tmp$ret$3);
963
- }
964
- tmp = new ConstructorStatement(tmp_0, toMap(destination));
965
- } else {
966
- tmp = transformChildren_0(stmt, tr);
967
- }
968
- return tmp;
969
- };
970
- }
971
- function RustIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
972
- return function () {
973
- var tmp0_reservedKeywords = minus(Companion_getInstance_0().o1z_1, setOf(['self', 'Self']));
974
- var tmp = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda;
975
- var tmp_0 = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_0;
976
- var tmp_1 = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_1;
977
- var tmp_2 = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_2;
978
- return new SanitizationConfig(tmp0_reservedKeywords, tmp, tmp_0, tmp_1, tmp_2, RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0), true);
979
- };
980
- }
981
- function RustIrEmitter$_get_sanitizationConfig_$ref_17ypni() {
982
- return function (p0) {
983
- return _get_sanitizationConfig__sns434(p0);
984
- };
985
- }
986
- function RustIrEmitter$shared$1() {
987
- this.r1y_1 = 'shared';
988
- this.s1y_1 = listOf_0([import_0('std::any', 'TypeId'), import_0('std::collections', 'HashMap')]);
989
- var tmp = this;
990
- tmp.t1y_1 = interface_0('RequestHeaders', VOID, RustIrEmitter$shared$o$requestHeaders$lambda);
991
- var tmp_0 = this;
992
- tmp_0.u1y_1 = interface_0('ResponseHeaders', VOID, RustIrEmitter$shared$o$responseHeaders$lambda);
993
- this.v1y_1 = new RawElement('pub trait Client {\n type Transport: Transportation;\n type Ser: Serialization;\n fn transport(&self) -> &Self::Transport;\n fn serialization(&self) -> &Self::Ser;\n}');
994
- this.w1y_1 = new RawElement("pub trait Server {\n type Req;\n type Res;\n fn path_template(&self) -> &'static str;\n fn method(&self) -> Method;\n}");
995
- var tmp_1 = this;
996
- tmp_1.x1y_1 = interface_0('Enum', VOID, RustIrEmitter$shared$o$enumTrait$lambda);
997
- var tmp_2 = this;
998
- tmp_2.y1y_1 = interface_0('Refined', VOID, RustIrEmitter$shared$o$refinedTrait$lambda);
999
- var tmp_3 = this;
1000
- tmp_3.z1y_1 = interface_0('Request', VOID, RustIrEmitter$shared$o$requestTrait$lambda);
1001
- var tmp_4 = this;
1002
- tmp_4.a1z_1 = interface_0('Response', VOID, RustIrEmitter$shared$o$responseTrait$lambda);
1003
- this.b1z_1 = mapOf([to('BodySerializer', new RawElement("pub trait BodySerializer {\n fn serialize_body<T: 'static>(&self, t: &T, r#type: TypeId) -> Vec<u8>;\n}")), to('BodyDeserializer', new RawElement("pub trait BodyDeserializer {\n fn deserialize_body<T: 'static>(&self, raw: &[u8], r#type: TypeId) -> T;\n}")), to('PathSerializer', new RawElement('pub trait PathSerializer {\n fn serialize_path<T: std::fmt::Display>(&self, t: &T, r#type: TypeId) -> String;\n}')), to('PathDeserializer', new RawElement('pub trait PathDeserializer {\n fn deserialize_path<T: std::str::FromStr>(&self, raw: &str, r#type: TypeId) -> T where T::Err: std::fmt::Debug;\n}')), to('ParamSerializer', new RawElement("pub trait ParamSerializer {\n fn serialize_param<T: 'static>(&self, value: &T, r#type: TypeId) -> Vec<String>;\n}")), to('ParamDeserializer', new RawElement("pub trait ParamDeserializer {\n fn deserialize_param<T: 'static>(&self, values: &[String], r#type: TypeId) -> T;\n}"))]);
1004
- var tmp_5 = this;
1005
- tmp_5.c1z_1 = interface_0('Transportation', VOID, RustIrEmitter$shared$o$transportationTrait$lambda);
1006
- this.d1z_1 = mapOf([to('Enum', this.x1y_1), to('Refined', this.y1y_1), to('Request', this.z1y_1), to('Response', this.a1z_1), to('Transportation', this.c1z_1)]);
1007
- var tmp_6 = this;
1240
+ function stripResponseGenerics(_this__u8e3s4) {
1241
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1008
1242
  // Inline function 'community.flock.wirespec.ir.core.transform' call
1009
- var this_0 = convert(new Shared(this.r1y_1));
1010
- var scope = new TransformScope(this_0);
1011
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1012
- var tmp_7 = scope;
1013
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1014
- var this_1 = scope.z1t_1;
1243
+ var scope = new TransformScope(_this__u8e3s4);
1244
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matching' call
1245
+ var tmp = scope;
1246
+ // Inline function 'community.flock.wirespec.ir.core.transformMatching' call
1247
+ var this_0 = scope.w1t_1;
1015
1248
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
1016
1249
  // Inline function 'kotlin.apply' call
1017
- var this_2 = new TransformerBuilder();
1018
- this_2.d1h(RustIrEmitter$shared$o$wirespecFile$lambda(this));
1019
- var tmp$ret$2 = this_2.e1h();
1020
- tmp_7.z1t_1 = transform(this_1, tmp$ret$2);
1250
+ var this_1 = new TransformerBuilder();
1251
+ this_1.c1u(stripResponseGenerics$lambda);
1252
+ var tmp$ret$2 = this_1.d1h();
1253
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1254
+ var tmp_0 = scope.w1t_1;
1255
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1256
+ }
1257
+ function stripHandlerExtends(_this__u8e3s4) {
1258
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1259
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1260
+ var scope = new TransformScope(_this__u8e3s4);
1021
1261
  // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1022
- var tmp_8 = scope;
1262
+ var tmp = scope;
1023
1263
  // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1024
- var this_3 = scope.z1t_1;
1264
+ var this_0 = scope.w1t_1;
1025
1265
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
1026
1266
  // Inline function 'kotlin.apply' call
1027
- var this_4 = new TransformerBuilder();
1028
- this_4.d1h(RustIrEmitter$shared$o$wirespecFile$lambda_0);
1029
- var tmp$ret$7 = this_4.e1h();
1030
- tmp_8.z1t_1 = transform(this_3, tmp$ret$7);
1031
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1032
- var tmp_9 = scope;
1033
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1034
- var this_5 = scope.z1t_1;
1267
+ var this_1 = new TransformerBuilder();
1268
+ this_1.c1h(stripHandlerExtends$lambda);
1269
+ var tmp$ret$2 = this_1.d1h();
1270
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1271
+ var tmp_0 = scope.w1t_1;
1272
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1273
+ }
1274
+ function convertSimpleRawExpressionsToVariableRefs(_this__u8e3s4) {
1275
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1276
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1277
+ var scope = new TransformScope(_this__u8e3s4);
1278
+ var identifierPattern = Regex_init_$Create$('[a-zA-Z_][a-zA-Z0-9_]*');
1279
+ scope.f1u(convertSimpleRawExpressionsToVariableRefs$lambda(identifierPattern));
1280
+ var tmp = scope.w1t_1;
1281
+ return isInterface(tmp, Element) ? tmp : THROW_CCE();
1282
+ }
1283
+ function stripWirespecPrefix(_this__u8e3s4) {
1284
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1285
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1286
+ var scope = new TransformScope(_this__u8e3s4);
1287
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matching' call
1288
+ var tmp = scope;
1289
+ // Inline function 'community.flock.wirespec.ir.core.transformMatching' call
1290
+ var this_0 = scope.w1t_1;
1035
1291
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
1036
1292
  // Inline function 'kotlin.apply' call
1037
- var this_6 = new TransformerBuilder();
1038
- this_6.d1h(RustIrEmitter$shared$o$wirespecFile$lambda_1(this));
1039
- var tmp$ret$12 = this_6.e1h();
1040
- tmp_9.z1t_1 = transform(this_5, tmp$ret$12);
1041
- var tmp_10 = scope.z1t_1;
1042
- // Inline function 'kotlin.let' call
1043
- var file = isInterface(tmp_10, Element) ? tmp_10 : THROW_CCE();
1044
- // Inline function 'kotlin.collections.flatMap' call
1045
- var tmp0 = file.u1m_1;
1046
- // Inline function 'kotlin.collections.flatMapTo' call
1047
- var destination = ArrayList_init_$Create$();
1293
+ var this_1 = new TransformerBuilder();
1294
+ this_1.c1u(stripWirespecPrefix$lambda);
1295
+ var tmp$ret$2 = this_1.d1h();
1296
+ tmp.w1t_1 = transform(this_0, tmp$ret$2);
1297
+ var tmp_0 = scope.w1t_1;
1298
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1299
+ }
1300
+ function flattenForRust(_this__u8e3s4) {
1301
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1302
+ // Inline function 'community.flock.wirespec.ir.core.findElement' call
1303
+ // Inline function 'kotlin.collections.filterIsInstance' call
1304
+ var tmp0 = _this__u8e3s4.t1m();
1305
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1306
+ var destination = ArrayList_init_$Create$_0();
1048
1307
  var _iterator__ex2g4s = tmp0.t();
1049
1308
  while (_iterator__ex2g4s.u()) {
1050
1309
  var element = _iterator__ex2g4s.v();
1051
- var tmp_11;
1052
- if (element instanceof Struct) {
1053
- var derive;
1054
- switch (element.f1n_1.x1l()) {
1055
- case 'RawRequest':
1056
- case 'RawResponse':
1057
- derive = '#[derive(Debug, Clone, PartialEq)]';
1058
- break;
1059
- default:
1060
- derive = '#[derive(Debug, Clone, Default, PartialEq)]';
1061
- break;
1062
- }
1063
- tmp_11 = listOf(new File(element.f1n_1, listOf_0([new RawElement(derive), element])));
1064
- } else {
1065
- tmp_11 = listOf(element);
1310
+ if (element instanceof Namespace) {
1311
+ destination.x(element);
1066
1312
  }
1067
- var list = tmp_11;
1068
- addAll(destination, list);
1069
1313
  }
1070
- var tmp0_0 = new File(file.t1m_1, destination);
1071
- // Inline function 'kotlin.let' call
1072
- tmp_6.e1z_1 = RustTransform_getInstance().w1z(tmp0_0);
1073
- var tmp_12 = this;
1074
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1075
- var this_7 = this.e1z_1;
1076
- var scope_0 = new TransformScope(this_7);
1077
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1078
- var tmp_13 = scope_0;
1079
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1080
- var this_8 = scope_0.z1t_1;
1081
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1082
- // Inline function 'kotlin.apply' call
1083
- var this_9 = new TransformerBuilder();
1084
- this_9.d1h(RustIrEmitter$shared$o$source$lambda);
1085
- var tmp$ret$26 = this_9.e1h();
1086
- tmp_13.z1t_1 = transform(this_8, tmp$ret$26);
1087
- var tmp_14 = scope_0.z1t_1;
1088
- // Inline function 'kotlin.let' call
1089
- var file_0 = isInterface(tmp_14, Element) ? tmp_14 : THROW_CCE();
1090
- // Inline function 'kotlin.collections.mutableListOf' call
1091
- var groups = ArrayList_init_$Create$();
1092
- // Inline function 'kotlin.collections.mutableListOf' call
1093
- var current = ArrayList_init_$Create$();
1094
- var _iterator__ex2g4s_0 = file_0.u1m_1.t();
1314
+ var tmp$ret$2 = firstOrNull_0(destination);
1315
+ var namespace = ensureNotNull(tmp$ret$2);
1316
+ var flattened = flattenNestedStructs(namespace);
1317
+ // Inline function 'kotlin.collections.filter' call
1318
+ var tmp0_0 = flattened.y1m_1;
1319
+ // Inline function 'kotlin.collections.filterTo' call
1320
+ var destination_0 = ArrayList_init_$Create$_0();
1321
+ var _iterator__ex2g4s_0 = tmp0_0.t();
1095
1322
  while (_iterator__ex2g4s_0.u()) {
1096
1323
  var element_0 = _iterator__ex2g4s_0.v();
1097
- if (element_0 instanceof Import) {
1098
- current.x(element_0);
1099
- } else {
1100
- // Inline function 'kotlin.collections.isNotEmpty' call
1101
- if (!current.r()) {
1102
- groups.x(current);
1103
- // Inline function 'kotlin.collections.mutableListOf' call
1104
- current = ArrayList_init_$Create$();
1105
- }
1106
- groups.x(listOf(element_0));
1107
- }
1108
- }
1109
- // Inline function 'kotlin.collections.isNotEmpty' call
1110
- if (!current.r()) {
1111
- groups.x(current);
1112
- }
1113
- tmp_12.f1z_1 = joinToString(groups, '\n\n', VOID, VOID, VOID, VOID, RustIrEmitter$shared$o$source$lambda_0) + '\n';
1114
- }
1115
- protoOf(RustIrEmitter$shared$1).r1w = function () {
1116
- return this.f1z_1;
1117
- };
1118
- function RustIrEmitter$emit$lambda(this$0) {
1119
- return function (a, b) {
1120
- // Inline function 'kotlin.comparisons.compareValuesBy' call
1121
- var this_0 = this$0;
1122
- var tmp = sort(this_0, a);
1123
- var this_1 = this$0;
1124
- var tmp$ret$1 = sort(this_1, b);
1125
- return compareValues(tmp, tmp$ret$1);
1126
- };
1127
- }
1128
- function emit$emitMod(this$0, def) {
1129
- return 'pub mod ' + sanitize(this$0, def.vq()) + ';';
1130
- }
1131
- function RustIrEmitter$emit$lambda_0(this$0) {
1132
- return function (it) {
1133
- return emit$emitMod(this$0, it);
1134
- };
1135
- }
1136
- function RustIrEmitter$emit$lambda_1(this$0) {
1137
- return function (it) {
1138
- return emit$emitMod(this$0, it);
1139
- };
1140
- }
1141
- function RustIrEmitter$emit$lambda_2(this$0) {
1142
- return function (element, transformer) {
1143
1324
  var tmp;
1144
- if (element instanceof Enum) {
1145
- // Inline function 'kotlin.collections.map' call
1146
- var this_0 = element.f1o_1;
1147
- // Inline function 'kotlin.collections.mapTo' call
1148
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1149
- var _iterator__ex2g4s = this_0.t();
1150
- while (_iterator__ex2g4s.u()) {
1151
- var item = _iterator__ex2g4s.v();
1152
- var tmp$ret$0 = item.c1o(Companion_getInstance().m1h(sanitizeKeywords(this$0, sanitizeEnum(this$0, item.z1n_1.s1h()))));
1153
- destination.x(tmp$ret$0);
1154
- }
1155
- tmp = element.k1o(VOID, VOID, destination);
1325
+ if (element_0 instanceof Struct) {
1326
+ tmp = true;
1156
1327
  } else {
1157
- tmp = element;
1328
+ tmp = element_0 instanceof Union;
1158
1329
  }
1159
- var transformed = tmp;
1160
- return transformChildren(transformed, transformer);
1161
- };
1162
- }
1163
- function RustIrEmitter$emit$lambda_3(this$0, $refined) {
1164
- return function (element, transformer) {
1165
- var tmp;
1166
- if (element instanceof Struct) {
1167
- tmp = element.l1n(VOID, VOID, VOID, VOID, listOf_0([buildValidateFunction(this$0, $refined), buildToStringFunction(this$0, $refined)]));
1168
- } else {
1169
- tmp = element;
1330
+ if (tmp) {
1331
+ destination_0.x(element_0);
1170
1332
  }
1171
- var transformed = tmp;
1172
- return transformChildren(transformed, transformer);
1173
- };
1174
- }
1175
- function RustIrEmitter$emit$lambda_4($identifierPattern) {
1176
- return function (s, t) {
1177
- var tmp;
1333
+ }
1334
+ // Inline function 'kotlin.collections.map' call
1335
+ // Inline function 'kotlin.collections.mapTo' call
1336
+ var destination_1 = ArrayList_init_$Create$(collectionSizeOrDefault(destination_0, 10));
1337
+ var _iterator__ex2g4s_1 = destination_0.t();
1338
+ while (_iterator__ex2g4s_1.u()) {
1339
+ var item = _iterator__ex2g4s_1.v();
1178
1340
  var tmp_0;
1179
1341
  var tmp_1;
1180
- if (s instanceof RawExpression) {
1181
- tmp_1 = $identifierPattern.nc(s.c1p_1);
1342
+ if (item instanceof Union) {
1343
+ tmp_1 = item.s1p_1.w1l() === 'Response';
1182
1344
  } else {
1183
1345
  tmp_1 = false;
1184
1346
  }
1185
1347
  if (tmp_1) {
1186
- tmp_0 = !contains(s.c1p_1, '.');
1348
+ // Inline function 'kotlin.collections.filterIsInstance' call
1349
+ var tmp0_1 = flattened.y1m_1;
1350
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1351
+ var destination_2 = ArrayList_init_$Create$_0();
1352
+ var _iterator__ex2g4s_2 = tmp0_1.t();
1353
+ while (_iterator__ex2g4s_2.u()) {
1354
+ var element_1 = _iterator__ex2g4s_2.v();
1355
+ if (element_1 instanceof Struct) {
1356
+ destination_2.x(element_1);
1357
+ }
1358
+ }
1359
+ // Inline function 'kotlin.collections.map' call
1360
+ // Inline function 'kotlin.collections.mapTo' call
1361
+ var destination_3 = ArrayList_init_$Create$(collectionSizeOrDefault(destination_2, 10));
1362
+ var _iterator__ex2g4s_3 = destination_2.t();
1363
+ while (_iterator__ex2g4s_3.u()) {
1364
+ var item_0 = _iterator__ex2g4s_3.v();
1365
+ var tmp$ret$8 = item_0.c1n_1.w1l();
1366
+ destination_3.x(tmp$ret$8);
1367
+ }
1368
+ // Inline function 'kotlin.collections.filter' call
1369
+ // Inline function 'kotlin.collections.filterTo' call
1370
+ var destination_4 = ArrayList_init_$Create$_0();
1371
+ var _iterator__ex2g4s_4 = destination_3.t();
1372
+ while (_iterator__ex2g4s_4.u()) {
1373
+ var element_2 = _iterator__ex2g4s_4.v();
1374
+ if (get_rustResponsePattern().nc(element_2)) {
1375
+ destination_4.x(element_2);
1376
+ }
1377
+ }
1378
+ // Inline function 'kotlin.collections.map' call
1379
+ // Inline function 'kotlin.collections.mapTo' call
1380
+ var destination_5 = ArrayList_init_$Create$(collectionSizeOrDefault(destination_4, 10));
1381
+ var _iterator__ex2g4s_5 = destination_4.t();
1382
+ while (_iterator__ex2g4s_5.u()) {
1383
+ var item_1 = _iterator__ex2g4s_5.v();
1384
+ var tmp$ret$14 = new Custom(item_1);
1385
+ destination_5.x(tmp$ret$14);
1386
+ }
1387
+ var members = destination_5;
1388
+ tmp_0 = item.x1p(VOID, VOID, members, emptyList());
1187
1389
  } else {
1188
- tmp_0 = false;
1390
+ if (item instanceof Union) {
1391
+ tmp_0 = item.x1p(VOID, VOID, VOID, emptyList());
1392
+ } else {
1393
+ tmp_0 = item;
1394
+ }
1189
1395
  }
1190
- if (tmp_0) {
1191
- tmp = new VariableReference(Companion_getInstance().m1h(s.c1p_1));
1396
+ var tmp$ret$17 = tmp_0;
1397
+ destination_1.x(tmp$ret$17);
1398
+ }
1399
+ var moduleElements = destination_1;
1400
+ // Inline function 'kotlin.collections.filterNot' call
1401
+ var tmp0_2 = flattened.y1m_1;
1402
+ // Inline function 'kotlin.collections.filterNotTo' call
1403
+ var destination_6 = ArrayList_init_$Create$_0();
1404
+ var _iterator__ex2g4s_6 = tmp0_2.t();
1405
+ while (_iterator__ex2g4s_6.u()) {
1406
+ var element_3 = _iterator__ex2g4s_6.v();
1407
+ var tmp_2;
1408
+ if (element_3 instanceof Struct) {
1409
+ tmp_2 = true;
1192
1410
  } else {
1193
- tmp = transformChildren_0(s, t);
1411
+ tmp_2 = element_3 instanceof Union;
1194
1412
  }
1195
- return tmp;
1196
- };
1413
+ if (!tmp_2) {
1414
+ destination_6.x(element_3);
1415
+ }
1416
+ }
1417
+ var classElements = destination_6;
1418
+ return new File(namespace.x1m_1, plus_0(moduleElements, new Namespace(namespace.x1m_1, classElements, namespace.z1m_1)));
1197
1419
  }
1198
- function RustIrEmitter$emit$lambda_5(this$0, $endpoint) {
1199
- return function (element, transformer) {
1200
- var tmp;
1201
- if (element instanceof Namespace) {
1202
- tmp = element.d1n(VOID, plus(element.a1n_1, listOf(buildApiStruct(this$0, $endpoint))));
1203
- } else {
1204
- tmp = element;
1420
+ function fixConstructorCalls() {
1421
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1422
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1423
+ // Inline function 'kotlin.apply' call
1424
+ var this_0 = new TransformerBuilder();
1425
+ this_0.f1u(fixConstructorCalls$lambda);
1426
+ return this_0.d1h();
1427
+ }
1428
+ function buildEndpointImports(_this__u8e3s4) {
1429
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1430
+ // Inline function 'kotlin.collections.distinctBy' call
1431
+ var this_0 = importReferences(_this__u8e3s4);
1432
+ var set = HashSet_init_$Create$();
1433
+ var list = ArrayList_init_$Create$_0();
1434
+ var _iterator__ex2g4s = this_0.t();
1435
+ while (_iterator__ex2g4s.u()) {
1436
+ var e = _iterator__ex2g4s.v();
1437
+ var key = e.ku_1;
1438
+ if (set.x(key)) {
1439
+ list.x(e);
1205
1440
  }
1206
- var transformed = tmp;
1207
- return transformChildren(transformed, transformer);
1208
- };
1441
+ }
1442
+ // Inline function 'kotlin.collections.map' call
1443
+ // Inline function 'kotlin.collections.mapTo' call
1444
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(list, 10));
1445
+ var _iterator__ex2g4s_0 = list.t();
1446
+ while (_iterator__ex2g4s_0.u()) {
1447
+ var item = _iterator__ex2g4s_0.v();
1448
+ var tmp$ret$2 = import_0('super::super::model::' + toRustSnakeCase(item.ku_1), item.ku_1);
1449
+ destination.x(tmp$ret$2);
1450
+ }
1451
+ return destination;
1209
1452
  }
1210
- function RustIrEmitter$emitClient$lambda(this$0) {
1211
- return function (endpoint) {
1212
- return 'pub mod ' + toSnakeCase(this$0, endpoint.ep_1.l1() + 'Client') + ';';
1213
- };
1453
+ function toRustSnakeCase(_this__u8e3s4) {
1454
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1455
+ return Companion_getInstance().l1h(_this__u8e3s4).x1l();
1214
1456
  }
1215
- function RustIrEmitter$toPascalCase$lambda(s) {
1216
- // Inline function 'kotlin.text.replaceFirstChar' call
1457
+ function buildValidateFunction(refined) {
1458
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1459
+ var constraintExpr = convertConstraint(refined.cr_1, new FieldCall(new VariableReference(Companion_getInstance().l1h('self')), Companion_getInstance().l1h('value')));
1460
+ return function_0('validate', VOID, VOID, buildValidateFunction$lambda(constraintExpr));
1461
+ }
1462
+ function buildToStringFunction(refined) {
1463
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1217
1464
  var tmp;
1218
- // Inline function 'kotlin.text.isNotEmpty' call
1219
- if (charSequenceLength(s) > 0) {
1220
- var it = charCodeAt(s, 0);
1221
- var tmp0 = uppercaseChar(it);
1222
- // Inline function 'kotlin.text.plus' call
1223
- var other = substring(s, 1);
1224
- tmp = toString(tmp0) + other;
1465
+ if (refined.cr_1.ou_1 instanceof String_0) {
1466
+ tmp = 'self.value.clone()';
1225
1467
  } else {
1226
- tmp = s;
1468
+ tmp = 'format!("{}", self.value)';
1227
1469
  }
1228
- return tmp;
1470
+ var expr = tmp;
1471
+ return function_0('to_string', VOID, VOID, buildToStringFunction$lambda(expr));
1229
1472
  }
1230
- function RustIrEmitter$injectSelfReceiver$lambda$lambda($fieldNames) {
1231
- return function (s, t) {
1232
- var tmp;
1233
- var tmp_0;
1473
+ function buildApiStruct(endpoint) {
1474
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1475
+ return new RawElement(generateApiStructCode(endpoint));
1476
+ }
1477
+ function generateApiStructCode(_this__u8e3s4) {
1478
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1479
+ // Inline function 'kotlin.let' call
1480
+ var pathTemplate = '/' + joinToString(_this__u8e3s4.gp_1, '/', VOID, VOID, VOID, VOID, generateApiStructCode$lambda);
1481
+ var methodName = _this__u8e3s4.fp_1.a3_1;
1482
+ return trimIndent('\n pub struct Api;\n impl Server for Api {\n type Req = Request;\n type Res = Response;\n fn path_template(&self) -> &\'static str { "' + pathTemplate + '" }\n fn method(&self) -> Method { Method::' + methodName + ' }\n }\n ');
1483
+ }
1484
+ function fixResponseSwitchPatterns$lambda(s, t) {
1485
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1486
+ var tmp;
1487
+ if (!(s instanceof Switch)) {
1488
+ tmp = true;
1489
+ } else {
1490
+ var tmp0_safe_receiver = s.a1p_1;
1491
+ tmp = !((tmp0_safe_receiver == null ? null : tmp0_safe_receiver.q1l()) === 'r');
1492
+ }
1493
+ if (tmp)
1494
+ return transformChildren(s, t);
1495
+ // Inline function 'kotlin.collections.map' call
1496
+ var this_0 = s.y1o_1;
1497
+ // Inline function 'kotlin.collections.mapTo' call
1498
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
1499
+ var _iterator__ex2g4s = this_0.t();
1500
+ while (_iterator__ex2g4s.u()) {
1501
+ var item = _iterator__ex2g4s.v();
1502
+ var tmp_0 = item.f1p_1;
1503
+ var tmp0_safe_receiver_0 = tmp_0 instanceof Custom ? tmp_0 : null;
1504
+ var typeName = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.p1h_1;
1234
1505
  var tmp_1;
1235
- if (s instanceof FieldCall) {
1236
- tmp_1 = s.i1p_1 == null;
1237
- } else {
1238
- tmp_1 = false;
1239
- }
1240
- if (tmp_1) {
1241
- tmp_0 = $fieldNames.u1(s.j1p_1.r1l());
1506
+ if (!(typeName == null) && get_rustResponsePattern().nc(typeName)) {
1507
+ var tmp_2 = new RawExpression('Response::' + typeName + '(' + ensureNotNull(s.a1p_1).x1l() + ')');
1508
+ // Inline function 'kotlin.collections.map' call
1509
+ var this_1 = item.e1p_1;
1510
+ // Inline function 'kotlin.collections.mapTo' call
1511
+ var destination_0 = ArrayList_init_$Create$(collectionSizeOrDefault(this_1, 10));
1512
+ var _iterator__ex2g4s_0 = this_1.t();
1513
+ while (_iterator__ex2g4s_0.u()) {
1514
+ var item_0 = _iterator__ex2g4s_0.v();
1515
+ var tmp$ret$0 = t.q1t(item_0);
1516
+ destination_0.x(tmp$ret$0);
1517
+ }
1518
+ tmp_1 = new Case(tmp_2, destination_0, null);
1242
1519
  } else {
1243
- tmp_0 = false;
1520
+ var tmp_3 = t.r1t(item.d1p_1);
1521
+ // Inline function 'kotlin.collections.map' call
1522
+ var this_2 = item.e1p_1;
1523
+ // Inline function 'kotlin.collections.mapTo' call
1524
+ var destination_1 = ArrayList_init_$Create$(collectionSizeOrDefault(this_2, 10));
1525
+ var _iterator__ex2g4s_1 = this_2.t();
1526
+ while (_iterator__ex2g4s_1.u()) {
1527
+ var item_1 = _iterator__ex2g4s_1.v();
1528
+ var tmp$ret$3 = t.q1t(item_1);
1529
+ destination_1.x(tmp$ret$3);
1530
+ }
1531
+ var tmp_4 = destination_1;
1532
+ var tmp1_safe_receiver = item.f1p_1;
1533
+ var tmp_5;
1534
+ if (tmp1_safe_receiver == null) {
1535
+ tmp_5 = null;
1536
+ } else {
1537
+ // Inline function 'kotlin.let' call
1538
+ tmp_5 = t.o1t(tmp1_safe_receiver);
1539
+ }
1540
+ tmp_1 = new Case(tmp_3, tmp_4, tmp_5);
1244
1541
  }
1245
- if (tmp_0) {
1246
- tmp = new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), s.j1p_1);
1542
+ var tmp$ret$8 = tmp_1;
1543
+ destination.x(tmp$ret$8);
1544
+ }
1545
+ var transformedCases = destination;
1546
+ return s.c1p(t.r1t(s.x1o_1), transformedCases, null);
1547
+ }
1548
+ function replaceStructWithRefinedFunctions$lambda($refined) {
1549
+ return function (element, transformer) {
1550
+ var tmp;
1551
+ if (element instanceof Struct) {
1552
+ tmp = element.i1n(VOID, VOID, VOID, VOID, listOf_0([buildValidateFunction($refined), buildToStringFunction($refined)]));
1247
1553
  } else {
1248
- tmp = transformChildren_0(s, t);
1554
+ tmp = element;
1249
1555
  }
1250
- return tmp;
1556
+ var transformed = tmp;
1557
+ return transformChildren_0(transformed, transformer);
1251
1558
  };
1252
1559
  }
1253
- function RustIrEmitter$injectSelfReceiver$lambda($fieldNames) {
1560
+ function injectApiStruct$lambda($endpoint) {
1254
1561
  return function (element, transformer) {
1255
1562
  var tmp;
1256
- if (element instanceof Function) {
1257
- var tmp_0;
1258
- if (element.t1j_1.equals(Companion_getInstance().m1h('validate'))) {
1259
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1260
- var this_0 = element.b1k(VOID, VOID, listOf(get_selfParam()));
1261
- var scope = new TransformScope(this_0);
1262
- scope.i1u(RustIrEmitter$injectSelfReceiver$lambda$lambda($fieldNames));
1263
- var tmp_1 = scope.z1t_1;
1264
- tmp_0 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1265
- } else {
1266
- tmp_0 = element;
1267
- }
1268
- tmp = tmp_0;
1563
+ if (element instanceof Namespace) {
1564
+ tmp = element.b1n(VOID, plus(element.y1m_1, listOf(buildApiStruct($endpoint))));
1269
1565
  } else {
1270
1566
  tmp = element;
1271
1567
  }
1272
1568
  var transformed = tmp;
1273
- return transformChildren(transformed, transformer);
1274
- };
1275
- }
1276
- function RustIrEmitter$stripWirespecPrefix$lambda(type, transformer) {
1277
- var tmp;
1278
- if (type instanceof Custom) {
1279
- tmp = startsWith(type.q1h_1, 'Wirespec.') ? type.n1m(removePrefix(type.q1h_1, 'Wirespec.')) : type;
1280
- } else {
1281
- tmp = type;
1282
- }
1283
- var transformed = tmp;
1284
- return transformChildren_1(transformed, transformer);
1285
- }
1286
- function RustIrEmitter$buildValidateFunction$lambda($constraintExpr) {
1287
- return function ($this$function) {
1288
- $this$function.l1i('&self', new Custom(''));
1289
- $this$function.k1i(Boolean_instance);
1290
- $this$function.j1k($constraintExpr);
1291
- return Unit_instance_0;
1292
- };
1293
- }
1294
- function RustIrEmitter$buildToStringFunction$lambda($expr) {
1295
- return function ($this$function) {
1296
- $this$function.l1i('&self', new Custom(''));
1297
- $this$function.k1i(String_instance);
1298
- $this$function.j1k(new RawExpression($expr));
1299
- return Unit_instance_0;
1300
- };
1301
- }
1302
- function RustIrEmitter$buildClientParams$lambda(this$0) {
1303
- return function (_destruct__k2r9zo) {
1304
- var name = _destruct__k2r9zo.ne();
1305
- var type = _destruct__k2r9zo.oe();
1306
- var tmp = sanitizeKeywords(this$0, name.y1l());
1307
- // Inline function 'kotlin.with' call
1308
- return tmp + ': ' + RustTransform_getInstance().x1z(type);
1309
- };
1310
- }
1311
- function RustIrEmitter$buildClientParams$lambda_0(this$0) {
1312
- return function (_destruct__k2r9zo) {
1313
- var name = _destruct__k2r9zo.ne();
1314
- return sanitizeKeywords(this$0, name.y1l());
1569
+ return transformChildren_0(transformed, transformer);
1315
1570
  };
1316
1571
  }
1317
- function RustIrEmitter$fixResponseSwitchPatterns$lambda(s, t) {
1572
+ function injectResponseFromImpls$lambda(element, transformer) {
1573
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1318
1574
  var tmp;
1319
- var tmp_0;
1320
- if (s instanceof Switch) {
1321
- var tmp0_safe_receiver = s.p1p_1;
1322
- tmp_0 = (tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r1l()) === 'r';
1323
- } else {
1324
- tmp_0 = false;
1325
- }
1326
- if (tmp_0) {
1327
- // Inline function 'kotlin.collections.map' call
1328
- var this_0 = s.n1p_1;
1329
- // Inline function 'kotlin.collections.mapTo' call
1330
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1331
- var _iterator__ex2g4s = this_0.t();
1575
+ if (element instanceof File) {
1576
+ // Inline function 'kotlin.collections.flatMap' call
1577
+ var tmp0 = element.s1m_1;
1578
+ // Inline function 'kotlin.collections.flatMapTo' call
1579
+ var destination = ArrayList_init_$Create$_0();
1580
+ var _iterator__ex2g4s = tmp0.t();
1332
1581
  while (_iterator__ex2g4s.u()) {
1333
- var item = _iterator__ex2g4s.v();
1334
- var tmp_1 = item.a1q_1;
1335
- var tmp0_safe_receiver_0 = tmp_1 instanceof Custom ? tmp_1 : null;
1336
- var typeName = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.q1h_1;
1582
+ var element_0 = _iterator__ex2g4s.v();
1583
+ var tmp_0;
1584
+ var tmp_1;
1337
1585
  var tmp_2;
1338
- if (!(typeName == null) && get_RESPONSE_PATTERN().nc(typeName)) {
1339
- var tmp_3 = new RawExpression('Response::' + typeName + '(' + ensureNotNull(s.p1p_1).y1l() + ')');
1586
+ if (element_0 instanceof Union) {
1587
+ tmp_2 = element_0.s1p_1.w1l() === 'Response';
1588
+ } else {
1589
+ tmp_2 = false;
1590
+ }
1591
+ if (tmp_2) {
1592
+ // Inline function 'kotlin.collections.isNotEmpty' call
1593
+ tmp_1 = !element_0.u1p_1.r();
1594
+ } else {
1595
+ tmp_1 = false;
1596
+ }
1597
+ if (tmp_1) {
1598
+ var tmp_3 = listOf(element_0);
1340
1599
  // Inline function 'kotlin.collections.map' call
1341
- var this_1 = item.z1p_1;
1600
+ var this_0 = element_0.u1p_1;
1342
1601
  // Inline function 'kotlin.collections.mapTo' call
1343
- var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
1344
- var _iterator__ex2g4s_0 = this_1.t();
1602
+ var destination_0 = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
1603
+ var _iterator__ex2g4s_0 = this_0.t();
1345
1604
  while (_iterator__ex2g4s_0.u()) {
1346
- var item_0 = _iterator__ex2g4s_0.v();
1347
- var tmp$ret$0 = t.t1t(item_0);
1348
- destination_0.x(tmp$ret$0);
1605
+ var item = _iterator__ex2g4s_0.v();
1606
+ var tmp$ret$1 = new RawElement('impl From<' + item.p1h_1 + '> for Response { fn from(value: ' + item.p1h_1 + ') -> Self { Response::' + item.p1h_1 + '(value) } }\n');
1607
+ destination_0.x(tmp$ret$1);
1349
1608
  }
1350
- tmp_2 = new Case(tmp_3, destination_0, null);
1609
+ tmp_0 = plus(tmp_3, destination_0);
1351
1610
  } else {
1352
- var tmp_4 = t.u1t(item.y1p_1);
1353
- // Inline function 'kotlin.collections.map' call
1354
- var this_2 = item.z1p_1;
1355
- // Inline function 'kotlin.collections.mapTo' call
1356
- var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_2, 10));
1357
- var _iterator__ex2g4s_1 = this_2.t();
1358
- while (_iterator__ex2g4s_1.u()) {
1359
- var item_1 = _iterator__ex2g4s_1.v();
1360
- var tmp$ret$3 = t.t1t(item_1);
1361
- destination_1.x(tmp$ret$3);
1611
+ tmp_0 = listOf(element_0);
1612
+ }
1613
+ var list = tmp_0;
1614
+ addAll(destination, list);
1615
+ }
1616
+ tmp = element.v1m(VOID, destination);
1617
+ } else {
1618
+ tmp = element;
1619
+ }
1620
+ var transformed = tmp;
1621
+ return transformChildren_0(transformed, transformer);
1622
+ }
1623
+ function injectHandlerImplForClient$lambda(element, transformer) {
1624
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1625
+ var tmp;
1626
+ if (element instanceof Namespace) {
1627
+ var tmp$ret$4;
1628
+ $l$block_1: {
1629
+ // Inline function 'kotlin.collections.filterIsInstance' call
1630
+ var tmp0 = element.y1m_1;
1631
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1632
+ var destination = ArrayList_init_$Create$_0();
1633
+ var _iterator__ex2g4s = tmp0.t();
1634
+ while (_iterator__ex2g4s.u()) {
1635
+ var element_0 = _iterator__ex2g4s.v();
1636
+ if (element_0 instanceof Interface) {
1637
+ destination.x(element_0);
1362
1638
  }
1363
- var tmp_5 = destination_1;
1364
- var tmp1_safe_receiver = item.a1q_1;
1365
- var tmp_6;
1366
- if (tmp1_safe_receiver == null) {
1367
- tmp_6 = null;
1368
- } else {
1369
- // Inline function 'kotlin.let' call
1370
- tmp_6 = t.r1t(tmp1_safe_receiver);
1639
+ }
1640
+ var tmp$ret$3;
1641
+ $l$block: {
1642
+ // Inline function 'kotlin.collections.firstOrNull' call
1643
+ var _iterator__ex2g4s_0 = destination.t();
1644
+ while (_iterator__ex2g4s_0.u()) {
1645
+ var element_1 = _iterator__ex2g4s_0.v();
1646
+ if (element_1.j1n_1.equals(Companion_getInstance().l1h('Handler'))) {
1647
+ tmp$ret$3 = element_1;
1648
+ break $l$block;
1649
+ }
1650
+ }
1651
+ tmp$ret$3 = null;
1652
+ }
1653
+ var tmp0_elvis_lhs = tmp$ret$3;
1654
+ var tmp_0;
1655
+ if (tmp0_elvis_lhs == null) {
1656
+ tmp$ret$4 = element;
1657
+ break $l$block_1;
1658
+ } else {
1659
+ tmp_0 = tmp0_elvis_lhs;
1660
+ }
1661
+ var handler = tmp_0;
1662
+ // Inline function 'kotlin.collections.filterIsInstance' call
1663
+ var tmp0_0 = handler.k1n_1;
1664
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1665
+ var destination_0 = ArrayList_init_$Create$_0();
1666
+ var _iterator__ex2g4s_1 = tmp0_0.t();
1667
+ while (_iterator__ex2g4s_1.u()) {
1668
+ var element_2 = _iterator__ex2g4s_1.v();
1669
+ if (element_2 instanceof Function) {
1670
+ destination_0.x(element_2);
1371
1671
  }
1372
- tmp_2 = new Case(tmp_4, tmp_5, tmp_6);
1373
1672
  }
1374
- var tmp$ret$8 = tmp_2;
1375
- destination.x(tmp$ret$8);
1673
+ var tmp1_elvis_lhs = firstOrNull_0(destination_0);
1674
+ var tmp_1;
1675
+ if (tmp1_elvis_lhs == null) {
1676
+ tmp$ret$4 = element;
1677
+ break $l$block_1;
1678
+ } else {
1679
+ tmp_1 = tmp1_elvis_lhs;
1680
+ }
1681
+ var method = tmp_1;
1682
+ var methodName = method.s1j_1.x1l();
1683
+ tmp$ret$4 = element.b1n(VOID, plus(element.y1m_1, listOf(new RawElement(trimIndent('\n impl<C: Client> Handler for C {\n async fn ' + methodName + '(&self, request: Request) -> Response {\n let raw = to_raw_request(self.serialization(), request);\n let resp = self.transport().transport(&raw).await;\n from_raw_response(self.serialization(), resp)\n }\n }\n ')))));
1376
1684
  }
1377
- var transformedCases = destination;
1378
- tmp = s.r1p(t.u1t(s.m1p_1), transformedCases, null);
1685
+ tmp = tmp$ret$4;
1379
1686
  } else {
1380
- tmp = transformChildren_0(s, t);
1687
+ tmp = element;
1381
1688
  }
1382
- return tmp;
1689
+ var transformed = tmp;
1690
+ return transformChildren_0(transformed, transformer);
1383
1691
  }
1384
- function RustIrEmitter$fixConstructorCalls$lambda(s, t) {
1692
+ function injectSelfToHandlerMethods$lambda(element, transformer) {
1693
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1385
1694
  var tmp;
1386
- if (s instanceof ConstructorStatement) {
1387
- var tmp_0 = s.p1m_1;
1388
- var tmp0_safe_receiver = tmp_0 instanceof Custom ? tmp_0 : null;
1389
- var typeName = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.q1h_1;
1390
- // Inline function 'kotlin.collections.mapValues' call
1391
- var this_0 = s.q1m_1;
1392
- // Inline function 'kotlin.collections.mapValuesTo' call
1393
- var destination = LinkedHashMap_init_$Create$(mapCapacity(this_0.a1()));
1394
- // Inline function 'kotlin.collections.associateByTo' call
1395
- var _iterator__ex2g4s = this_0.j1().t();
1396
- while (_iterator__ex2g4s.u()) {
1397
- var element = _iterator__ex2g4s.v();
1398
- var tmp_1 = element.k1();
1399
- var tmp$ret$1 = t.u1t(element.l1());
1400
- destination.w2(tmp_1, tmp$ret$1);
1401
- }
1402
- var transformedArgs = destination;
1403
- var tmp_2;
1404
- if (!(typeName == null) && get_RESPONSE_PATTERN().nc(typeName)) {
1405
- tmp_2 = new FunctionCall(VOID, VOID, new Name(listOf('Response::' + typeName)), mapOf_0(to(Companion_getInstance().m1h('inner'), new FunctionCall(VOID, VOID, new Name(listOf(typeName + '::new')), transformedArgs))));
1406
- } else if (typeName === 'Request') {
1407
- tmp_2 = new FunctionCall(VOID, VOID, new Name(listOf('Request::new')), transformedArgs);
1408
- } else {
1409
- tmp_2 = transformChildren_0(s, t);
1695
+ if (element instanceof Interface) {
1696
+ var tmp$ret$0;
1697
+ $l$block: {
1698
+ if (!element.j1n_1.equals(Companion_getInstance().l1h('Handler')) && !element.j1n_1.equals(Companion_getInstance().l1h('Call'))) {
1699
+ tmp$ret$0 = element;
1700
+ break $l$block;
1701
+ }
1702
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1703
+ var scope = new TransformScope(element);
1704
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1705
+ var tmp_0 = scope;
1706
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1707
+ var this_0 = scope.w1t_1;
1708
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1709
+ // Inline function 'kotlin.apply' call
1710
+ var this_1 = new TransformerBuilder();
1711
+ this_1.c1h(injectSelfToHandlerMethods$lambda$lambda);
1712
+ var tmp$ret$3 = this_1.d1h();
1713
+ tmp_0.w1t_1 = transform(this_0, tmp$ret$3);
1714
+ var tmp_1 = scope.w1t_1;
1715
+ tmp$ret$0 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1410
1716
  }
1411
- tmp = tmp_2;
1717
+ tmp = tmp$ret$0;
1412
1718
  } else {
1413
- tmp = transformChildren_0(s, t);
1719
+ tmp = element;
1414
1720
  }
1415
- return tmp;
1721
+ var transformed = tmp;
1722
+ return transformChildren_0(transformed, transformer);
1416
1723
  }
1417
- function RustIrEmitter$stripHandlerExtends$lambda(element, transformer) {
1724
+ function injectSelfToHandlerMethods$lambda$lambda(element, transformer) {
1725
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1418
1726
  var tmp;
1419
- if (element instanceof Interface) {
1420
- tmp = element.m1o_1.equals(Companion_getInstance().m1h('Handler')) || element.m1o_1.equals(Companion_getInstance().m1h('Call')) ? element.t1o(VOID, VOID, emptyList()) : element;
1727
+ if (element instanceof Function) {
1728
+ tmp = element.a1k(Companion_getInstance().l1h(element.s1j_1.x1l()), VOID, plus(listOf(get_rustSelfParam()), element.u1j_1));
1421
1729
  } else {
1422
1730
  tmp = element;
1423
1731
  }
1424
1732
  var transformed = tmp;
1425
- return transformChildren(transformed, transformer);
1733
+ return transformChildren_0(transformed, transformer);
1426
1734
  }
1427
- function RustIrEmitter$stripResponseGenerics$lambda(type, transformer) {
1735
+ function stripResponseGenerics$lambda(type, transformer) {
1736
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1428
1737
  var tmp;
1429
1738
  if (type instanceof Custom) {
1430
1739
  var tmp_0;
1431
1740
  var tmp_1;
1432
- if (startsWith(type.q1h_1, 'Response')) {
1741
+ if (startsWith(type.p1h_1, 'Response')) {
1433
1742
  // Inline function 'kotlin.collections.isNotEmpty' call
1434
- tmp_1 = !type.r1h_1.r();
1743
+ tmp_1 = !type.q1h_1.r();
1435
1744
  } else {
1436
1745
  tmp_1 = false;
1437
1746
  }
1438
1747
  if (tmp_1) {
1439
- tmp_0 = type.n1m(VOID, emptyList());
1748
+ tmp_0 = type.m1m(VOID, emptyList());
1440
1749
  } else {
1441
1750
  tmp_0 = type;
1442
1751
  }
@@ -1447,158 +1756,99 @@ function RustIrEmitter$stripResponseGenerics$lambda(type, transformer) {
1447
1756
  var transformed = tmp;
1448
1757
  return transformChildren_1(transformed, transformer);
1449
1758
  }
1450
- function RustIrEmitter$injectSelfToHandlerMethods$lambda(element, transformer) {
1759
+ function stripHandlerExtends$lambda(element, transformer) {
1760
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1451
1761
  var tmp;
1452
1762
  if (element instanceof Interface) {
1453
- var tmp_0;
1454
- if (element.m1o_1.equals(Companion_getInstance().m1h('Handler')) || element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
1455
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1456
- var scope = new TransformScope(element);
1457
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1458
- var tmp_1 = scope;
1459
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1460
- var this_0 = scope.z1t_1;
1461
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1462
- // Inline function 'kotlin.apply' call
1463
- var this_1 = new TransformerBuilder();
1464
- this_1.d1h(RustIrEmitter$injectSelfToHandlerMethods$lambda$lambda);
1465
- var tmp$ret$2 = this_1.e1h();
1466
- tmp_1.z1t_1 = transform(this_0, tmp$ret$2);
1467
- var tmp_2 = scope.z1t_1;
1468
- tmp_0 = isInterface(tmp_2, Element) ? tmp_2 : THROW_CCE();
1469
- } else {
1470
- tmp_0 = element;
1471
- }
1472
- tmp = tmp_0;
1763
+ tmp = element.j1n_1.equals(Companion_getInstance().l1h('Handler')) || element.j1n_1.equals(Companion_getInstance().l1h('Call')) ? element.q1n(VOID, VOID, emptyList()) : element;
1473
1764
  } else {
1474
1765
  tmp = element;
1475
1766
  }
1476
1767
  var transformed = tmp;
1477
- return transformChildren(transformed, transformer);
1768
+ return transformChildren_0(transformed, transformer);
1478
1769
  }
1479
- function RustIrEmitter$injectSelfToHandlerMethods$lambda$lambda(element, transformer) {
1480
- var tmp;
1481
- if (element instanceof Function) {
1482
- tmp = element.b1k(Companion_getInstance().m1h(element.t1j_1.y1l()), VOID, plus(listOf(get_selfParam()), element.v1j_1));
1483
- } else {
1484
- tmp = element;
1485
- }
1486
- var transformed = tmp;
1487
- return transformChildren(transformed, transformer);
1488
- }
1489
- function RustIrEmitter$injectHandlerImplForClient$lambda(element, transformer) {
1490
- var tmp;
1491
- if (element instanceof Namespace) {
1492
- // Inline function 'kotlin.collections.filterIsInstance' call
1493
- var tmp0 = element.a1n_1;
1494
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
1495
- var destination = ArrayList_init_$Create$();
1496
- var _iterator__ex2g4s = tmp0.t();
1497
- while (_iterator__ex2g4s.u()) {
1498
- var element_0 = _iterator__ex2g4s.v();
1499
- if (element_0 instanceof Interface) {
1500
- destination.x(element_0);
1501
- }
1770
+ function convertSimpleRawExpressionsToVariableRefs$lambda($identifierPattern) {
1771
+ return function (s, t) {
1772
+ var tmp;
1773
+ var tmp_0;
1774
+ var tmp_1;
1775
+ if (s instanceof RawExpression) {
1776
+ tmp_1 = $identifierPattern.nc(s.h1o_1);
1777
+ } else {
1778
+ tmp_1 = false;
1502
1779
  }
1503
- var tmp$ret$3;
1504
- $l$block: {
1505
- // Inline function 'kotlin.collections.firstOrNull' call
1506
- var _iterator__ex2g4s_0 = destination.t();
1507
- while (_iterator__ex2g4s_0.u()) {
1508
- var element_1 = _iterator__ex2g4s_0.v();
1509
- if (element_1.m1o_1.equals(Companion_getInstance().m1h('Handler'))) {
1510
- tmp$ret$3 = element_1;
1511
- break $l$block;
1512
- }
1513
- }
1514
- tmp$ret$3 = null;
1780
+ if (tmp_1) {
1781
+ tmp_0 = !contains(s.h1o_1, '.');
1782
+ } else {
1783
+ tmp_0 = false;
1784
+ }
1785
+ if (tmp_0) {
1786
+ tmp = new VariableReference(Companion_getInstance().l1h(s.h1o_1));
1787
+ } else {
1788
+ tmp = transformChildren(s, t);
1515
1789
  }
1516
- var handler = tmp$ret$3;
1790
+ return tmp;
1791
+ };
1792
+ }
1793
+ function stripWirespecPrefix$lambda(type, transformer) {
1794
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1795
+ var tmp;
1796
+ if (type instanceof Custom) {
1517
1797
  var tmp_0;
1518
- if (!(handler == null)) {
1519
- // Inline function 'kotlin.collections.filterIsInstance' call
1520
- var tmp0_0 = handler.n1o_1;
1521
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
1522
- var destination_0 = ArrayList_init_$Create$();
1523
- var _iterator__ex2g4s_1 = tmp0_0.t();
1524
- while (_iterator__ex2g4s_1.u()) {
1525
- var element_2 = _iterator__ex2g4s_1.v();
1526
- if (element_2 instanceof Function) {
1527
- destination_0.x(element_2);
1528
- }
1529
- }
1530
- var method = firstOrNull_0(destination_0);
1531
- var tmp_1;
1532
- if (!(method == null)) {
1533
- var methodName = method.t1j_1.y1l();
1534
- tmp_1 = element.d1n(VOID, plus(element.a1n_1, listOf(new RawElement(trimIndent('\n impl<C: Client> Handler for C {\n async fn ' + methodName + '(&self, request: Request) -> Response {\n let raw = to_raw_request(self.serialization(), request);\n let resp = self.transport().transport(&raw).await;\n from_raw_response(self.serialization(), resp)\n }\n }\n ')))));
1535
- } else {
1536
- tmp_1 = element;
1537
- }
1538
- tmp_0 = tmp_1;
1798
+ if (startsWith(type.p1h_1, 'Wirespec.')) {
1799
+ tmp_0 = type.m1m(removePrefix(type.p1h_1, 'Wirespec.'));
1539
1800
  } else {
1540
- tmp_0 = element;
1801
+ tmp_0 = type;
1541
1802
  }
1542
1803
  tmp = tmp_0;
1543
1804
  } else {
1544
- tmp = element;
1805
+ tmp = type;
1545
1806
  }
1546
1807
  var transformed = tmp;
1547
- return transformChildren(transformed, transformer);
1808
+ return transformChildren_1(transformed, transformer);
1548
1809
  }
1549
- function RustIrEmitter$injectResponseFromImpls$lambda(element, transformer) {
1550
- var tmp;
1551
- if (element instanceof File) {
1552
- // Inline function 'kotlin.collections.flatMap' call
1553
- var tmp0 = element.u1m_1;
1554
- // Inline function 'kotlin.collections.flatMapTo' call
1555
- var destination = ArrayList_init_$Create$();
1556
- var _iterator__ex2g4s = tmp0.t();
1557
- while (_iterator__ex2g4s.u()) {
1558
- var element_0 = _iterator__ex2g4s.v();
1559
- var tmp_0;
1560
- var tmp_1;
1561
- var tmp_2;
1562
- if (element_0 instanceof Union) {
1563
- tmp_2 = element_0.d1q_1.x1l() === 'Response';
1564
- } else {
1565
- tmp_2 = false;
1566
- }
1567
- if (tmp_2) {
1568
- // Inline function 'kotlin.collections.isNotEmpty' call
1569
- tmp_1 = !element_0.f1q_1.r();
1570
- } else {
1571
- tmp_1 = false;
1572
- }
1573
- if (tmp_1) {
1574
- var tmp_3 = listOf(element_0);
1575
- // Inline function 'kotlin.collections.map' call
1576
- var this_0 = element_0.f1q_1;
1577
- // Inline function 'kotlin.collections.mapTo' call
1578
- var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1579
- var _iterator__ex2g4s_0 = this_0.t();
1580
- while (_iterator__ex2g4s_0.u()) {
1581
- var item = _iterator__ex2g4s_0.v();
1582
- var tmp$ret$1 = new RawElement('impl From<' + item.q1h_1 + '> for Response { fn from(value: ' + item.q1h_1 + ') -> Self { Response::' + item.q1h_1 + '(value) } }\n');
1583
- destination_0.x(tmp$ret$1);
1584
- }
1585
- tmp_0 = plus(tmp_3, destination_0);
1586
- } else {
1587
- tmp_0 = listOf(element_0);
1588
- }
1589
- var list = tmp_0;
1590
- addAll(destination, list);
1591
- }
1592
- tmp = element.x1m(VOID, destination);
1593
- } else {
1594
- tmp = element;
1810
+ function fixConstructorCalls$lambda(s, t) {
1811
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1812
+ if (!(s instanceof ConstructorStatement))
1813
+ return transformChildren(s, t);
1814
+ var tmp = s.o1m_1;
1815
+ var tmp0_safe_receiver = tmp instanceof Custom ? tmp : null;
1816
+ var typeName = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.p1h_1;
1817
+ // Inline function 'kotlin.collections.mapValues' call
1818
+ var this_0 = s.p1m_1;
1819
+ // Inline function 'kotlin.collections.mapValuesTo' call
1820
+ var destination = LinkedHashMap_init_$Create$(mapCapacity(this_0.a1()));
1821
+ // Inline function 'kotlin.collections.associateByTo' call
1822
+ var _iterator__ex2g4s = this_0.j1().t();
1823
+ while (_iterator__ex2g4s.u()) {
1824
+ var element = _iterator__ex2g4s.v();
1825
+ var tmp_0 = element.k1();
1826
+ var tmp$ret$1 = t.r1t(element.l1());
1827
+ destination.w2(tmp_0, tmp$ret$1);
1595
1828
  }
1596
- var transformed = tmp;
1597
- return transformChildren(transformed, transformer);
1829
+ var transformedArgs = destination;
1830
+ return !(typeName == null) && get_rustResponsePattern().nc(typeName) ? new FunctionCall(VOID, VOID, new Name(listOf('Response::' + typeName)), mapOf_0(to(Companion_getInstance().l1h('inner'), new FunctionCall(VOID, VOID, new Name(listOf(typeName + '::new')), transformedArgs)))) : typeName === 'Request' ? new FunctionCall(VOID, VOID, new Name(listOf('Request::new')), transformedArgs) : transformChildren(s, t);
1831
+ }
1832
+ function buildValidateFunction$lambda($constraintExpr) {
1833
+ return function ($this$function) {
1834
+ $this$function.k1i('&self', new Custom(''));
1835
+ $this$function.j1i(Boolean_instance);
1836
+ $this$function.i1k($constraintExpr);
1837
+ return Unit_instance;
1838
+ };
1598
1839
  }
1599
- function RustIrEmitter$generateApiStruct$lambda(segment) {
1840
+ function buildToStringFunction$lambda($expr) {
1841
+ return function ($this$function) {
1842
+ $this$function.k1i('&self', new Custom(''));
1843
+ $this$function.j1i(String_instance);
1844
+ $this$function.i1k(new RawExpression($expr));
1845
+ return Unit_instance;
1846
+ };
1847
+ }
1848
+ function generateApiStructCode$lambda(segment) {
1849
+ _init_properties_RustIrTransformer_kt__rrvmwq();
1600
1850
  var tmp;
1601
- if (segment instanceof Literal_0) {
1851
+ if (segment instanceof Literal) {
1602
1852
  tmp = segment.hq_1;
1603
1853
  } else {
1604
1854
  if (segment instanceof Param) {
@@ -1609,419 +1859,43 @@ function RustIrEmitter$generateApiStruct$lambda(segment) {
1609
1859
  }
1610
1860
  return tmp;
1611
1861
  }
1612
- function RustIrEmitter(packageName, emitShared) {
1613
- Companion_getInstance_0();
1614
- packageName = packageName === VOID ? Companion_instance_0.lr('community.flock.wirespec.generated') : packageName;
1615
- emitShared = emitShared === VOID ? Companion_instance_1.go() : emitShared;
1616
- this.g1z_1 = packageName;
1617
- this.h1z_1 = emitShared;
1618
- this.i1z_1 = RustGenerator_instance;
1619
- this.j1z_1 = FileExtension_Rust_getInstance();
1620
- var tmp = this;
1621
- tmp.k1z_1 = lazy(RustIrEmitter$sanitizationConfig$delegate$lambda(this));
1622
- this.l1z_1 = listOf_0([import_0('super::super::wirespec', '*'), import_0('', 'regex')]);
1623
- this.m1z_1 = listOf_0([import_0('super::super::wirespec', '*'), import_0('', 'regex')]);
1624
- var tmp_0 = this;
1625
- tmp_0.n1z_1 = new RustIrEmitter$shared$1();
1626
- }
1627
- protoOf(RustIrEmitter).m1u = function () {
1628
- return this.i1z_1;
1629
- };
1630
- protoOf(RustIrEmitter).eq = function () {
1631
- return this.j1z_1;
1632
- };
1633
- protoOf(RustIrEmitter).t1v = function () {
1634
- return this.n1z_1;
1635
- };
1636
- protoOf(RustIrEmitter).n1u = function (module_0, logger) {
1637
- // Inline function 'kotlin.collections.sortedBy' call
1638
- var this_0 = new NonEmptyList(module_0.dq_1);
1639
- // Inline function 'kotlin.comparisons.compareBy' call
1640
- var tmp = RustIrEmitter$emit$lambda(this);
1641
- var tmp$ret$0 = new sam$kotlin_Comparator$0(tmp);
1642
- var tmp$ret$1 = sortedWith(this_0, tmp$ret$0);
1643
- var tmp_0 = toNonEmptyListOrNull(tmp$ret$1);
1644
- var statements = ensureNotNull(tmp_0 == null ? null : new NonEmptyList(tmp_0)).yl_1;
1645
- // Inline function 'kotlin.let' call
1646
- var files = emit.call(this, module_0.wu(VOID, statements), logger);
1647
- // Inline function 'kotlin.collections.filterIsInstance' call
1648
- var tmp0 = new NonEmptyList(module_0.dq_1);
1649
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
1650
- var destination = ArrayList_init_$Create$();
1651
- var _iterator__ex2g4s = tmp0.t();
1652
- while (_iterator__ex2g4s.u()) {
1653
- var element = _iterator__ex2g4s.v();
1654
- if (element instanceof Endpoint) {
1655
- destination.x(element);
1656
- }
1657
- }
1658
- var endpoints = destination;
1659
- var endpointMods = joinToString(endpoints, '\n', VOID, VOID, VOID, VOID, RustIrEmitter$emit$lambda_0(this));
1660
- var tmp_1;
1661
- // Inline function 'kotlin.collections.isNotEmpty' call
1662
- if (!endpoints.r()) {
1663
- tmp_1 = '\npub mod client;';
1664
- } else {
1665
- tmp_1 = '';
1666
- }
1667
- var clientMod = tmp_1;
1668
- var modRs = new File(Companion_getInstance().m1h(this.g1z_1.or() + 'mod'), listOf(new RawElement('#![allow(warnings)]\npub mod model;\npub mod endpoint;' + clientMod + '\npub mod wirespec;')));
1669
- var modEndpoint = new File(Companion_getInstance().m1h(this.g1z_1.or() + 'endpoint/' + 'mod'), listOf(new RawElement(endpointMods)));
1670
- var tmp_2 = Companion_getInstance().m1h(this.g1z_1.or() + 'model/' + 'mod');
1671
- // Inline function 'kotlin.collections.filterIsInstance' call
1672
- var tmp0_0 = new NonEmptyList(module_0.dq_1);
1673
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
1674
- var destination_0 = ArrayList_init_$Create$();
1675
- var _iterator__ex2g4s_0 = tmp0_0.t();
1676
- while (_iterator__ex2g4s_0.u()) {
1677
- var element_0 = _iterator__ex2g4s_0.v();
1678
- if (!(element_0 == null) ? isInterface(element_0, Model) : false) {
1679
- destination_0.x(element_0);
1680
- }
1681
- }
1682
- var tmp_3 = destination_0;
1683
- var modModel = new File(tmp_2, listOf(new RawElement(joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, RustIrEmitter$emit$lambda_1(this)))));
1684
- var shared = new File(Companion_getInstance().m1h(this.g1z_1.or() + 'wirespec'), listOf(new RawElement(this.t1v().r1w())));
1685
- return this.h1z_1.ho_1 ? NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(files, modRs), modEndpoint), modModel), shared) : NonEmptyList__plus_impl_xqmb9(files, modRs);
1686
- };
1687
- protoOf(RustIrEmitter).uq = function (definition, module_0, logger) {
1688
- var subPackageName = plus_1(this.g1z_1, definition);
1689
- var tmp;
1690
- if (definition instanceof Endpoint) {
1691
- tmp = this.m1z_1;
1692
- } else {
1693
- tmp = this.l1z_1;
1694
- }
1695
- var importHeader = tmp;
1696
- var tmp0 = emit_0.call(this, definition, module_0, logger);
1697
- // Inline function 'kotlin.let' call
1698
- var file = RustTransform_getInstance().w1z(tmp0);
1699
- var tmp_0 = Companion_getInstance().m1h(subPackageName.or() + toSnakeCase(this, file.t1m_1.x1l()));
1700
- // Inline function 'kotlin.collections.flatMap' call
1701
- var tmp0_0 = file.u1m_1;
1702
- // Inline function 'kotlin.collections.flatMapTo' call
1703
- var destination = ArrayList_init_$Create$();
1704
- var _iterator__ex2g4s = tmp0_0.t();
1705
- while (_iterator__ex2g4s.u()) {
1706
- var element = _iterator__ex2g4s.v();
1707
- var tmp_1;
1708
- if (element instanceof Struct) {
1709
- tmp_1 = listOf_0([new RawElement('#[derive(Debug, Clone, Default, PartialEq)]'), element]);
1710
- } else {
1711
- tmp_1 = listOf(element);
1712
- }
1713
- var list = tmp_1;
1714
- addAll(destination, list);
1715
- }
1716
- return new File(tmp_0, plus(importHeader, destination));
1717
- };
1718
- protoOf(RustIrEmitter).up = function (type, module_0) {
1719
- var tmp = convertWithValidation(type, module_0);
1720
- // Inline function 'kotlin.collections.map' call
1721
- var this_0 = type.wo_1.so_1;
1722
- // Inline function 'kotlin.collections.mapTo' call
1723
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1724
- var _iterator__ex2g4s = this_0.t();
1725
- while (_iterator__ex2g4s.u()) {
1726
- var item = _iterator__ex2g4s.v();
1727
- var tmp$ret$0 = item.ap_1.l1();
1728
- destination.x(tmp$ret$0);
1729
- }
1730
- return prependImports(this, sanitizeNames(injectSelfReceiver(this, tmp, toSet(destination)), _get_sanitizationConfig__sns434(this)), buildModelImports(this, type));
1731
- };
1732
- protoOf(RustIrEmitter).ir = function (enum_0, module_0) {
1733
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1734
- var this_0 = convert_0(enum_0);
1735
- var scope = new TransformScope(this_0);
1736
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1737
- var tmp = scope;
1738
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1739
- var this_1 = scope.z1t_1;
1740
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1741
- // Inline function 'kotlin.apply' call
1742
- var this_2 = new TransformerBuilder();
1743
- this_2.d1h(RustIrEmitter$emit$lambda_2(this));
1744
- var tmp$ret$2 = this_2.e1h();
1745
- tmp.z1t_1 = transform(this_1, tmp$ret$2);
1746
- var tmp_0 = scope.z1t_1;
1747
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1748
- };
1749
- protoOf(RustIrEmitter).yq = function (union) {
1750
- return convert_1(union);
1751
- };
1752
- protoOf(RustIrEmitter).dr = function (refined) {
1753
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1754
- var this_0 = convert_2(refined);
1755
- var scope = new TransformScope(this_0);
1756
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1757
- var tmp = scope;
1758
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1759
- var this_1 = scope.z1t_1;
1760
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1761
- // Inline function 'kotlin.apply' call
1762
- var this_2 = new TransformerBuilder();
1763
- this_2.d1h(RustIrEmitter$emit$lambda_3(this, refined));
1764
- var tmp$ret$2 = this_2.e1h();
1765
- tmp.z1t_1 = transform(this_1, tmp$ret$2);
1766
- var tmp_0 = scope.z1t_1;
1767
- return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1768
- };
1769
- protoOf(RustIrEmitter).jr = function (endpoint) {
1770
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1771
- var this_0 = stripWirespecPrefix(this, flattenForRust(this, convert_3(endpoint)));
1772
- var scope = new TransformScope(this_0);
1773
- var identifierPattern = Regex_init_$Create$('[a-zA-Z_][a-zA-Z0-9_]*');
1774
- scope.i1u(RustIrEmitter$emit$lambda_4(identifierPattern));
1775
- var tmp = scope.z1t_1;
1776
- var tmp$ret$1 = isInterface(tmp, Element) ? tmp : THROW_CCE();
1777
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1778
- var this_1 = stripResponseGenerics(this, stripHandlerExtends(this, tmp$ret$1));
1779
- var scope_0 = new TransformScope(this_1);
1780
- scope_0.e1u(fixResponseSwitchPatterns(this));
1781
- var tmp_0 = scope_0.z1t_1;
1782
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1783
- var this_2 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1784
- var scope_1 = new TransformScope(this_2);
1785
- scope_1.e1u(fixConstructorCalls(this));
1786
- var tmp_1 = scope_1.z1t_1;
1787
- var tmp$ret$5 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1788
- // Inline function 'community.flock.wirespec.ir.core.transform' call
1789
- var this_3 = injectResponseFromImpls(this, injectHandlerImplForClient(this, injectSelfToHandlerMethods(this, tmp$ret$5), endpoint));
1790
- var scope_2 = new TransformScope(this_3);
1791
- // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1792
- var tmp_2 = scope_2;
1793
- // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1794
- var this_4 = scope_2.z1t_1;
1795
- // Inline function 'community.flock.wirespec.ir.core.transformer' call
1796
- // Inline function 'kotlin.apply' call
1797
- var this_5 = new TransformerBuilder();
1798
- this_5.d1h(RustIrEmitter$emit$lambda_5(this, endpoint));
1799
- var tmp$ret$8 = this_5.e1h();
1800
- tmp_2.z1t_1 = transform(this_4, tmp$ret$8);
1801
- var tmp_3 = scope_2.z1t_1;
1802
- var tmp$ret$12 = isInterface(tmp_3, Element) ? tmp_3 : THROW_CCE();
1803
- return prependImports(this, sanitizeNames(tmp$ret$12, _get_sanitizationConfig__sns434(this)), buildEndpointImports(this, endpoint));
1804
- };
1805
- protoOf(RustIrEmitter).xq = function (channel) {
1806
- return convert_4(channel);
1807
- };
1808
- protoOf(RustIrEmitter).q1u = function (endpoint) {
1809
- var endpointName = endpoint.ep_1.l1();
1810
- var endpointModuleName = toSnakeCase(this, endpointName);
1811
- var clientName = endpointName + 'Client';
1812
- var methodName = toSnakeCase(this, endpointName);
1813
- var _destruct__k2r9zo = buildClientParams(this, endpoint);
1814
- var paramsStr = _destruct__k2r9zo.ne();
1815
- var requestArgs = _destruct__k2r9zo.oe();
1816
- var requestConstruction = endpointModuleName + '::Request::new(' + requestArgs + ')';
1817
- // Inline function 'kotlin.collections.distinctBy' call
1818
- var this_0 = importReferences(endpoint);
1819
- var set = HashSet_init_$Create$();
1820
- var list = ArrayList_init_$Create$();
1821
- var _iterator__ex2g4s = this_0.t();
1822
- while (_iterator__ex2g4s.u()) {
1823
- var e = _iterator__ex2g4s.v();
1824
- var key = e.lu_1;
1825
- if (set.x(key)) {
1826
- list.x(e);
1827
- }
1828
- }
1829
- // Inline function 'kotlin.collections.map' call
1830
- // Inline function 'kotlin.collections.mapTo' call
1831
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
1832
- var _iterator__ex2g4s_0 = list.t();
1833
- while (_iterator__ex2g4s_0.u()) {
1834
- var item = _iterator__ex2g4s_0.v();
1835
- var tmp$ret$2 = import_0('super::super::model::' + toSnakeCase(this, item.lu_1), item.lu_1);
1836
- destination.x(tmp$ret$2);
1837
- }
1838
- var modelImports = destination;
1839
- var namespacePath = endpointModuleName + '::' + endpointName;
1840
- // Inline function 'kotlin.collections.buildList' call
1841
- // Inline function 'kotlin.collections.buildListInternal' call
1842
- // Inline function 'kotlin.apply' call
1843
- var this_1 = ArrayList_init_$Create$();
1844
- this_1.x('pub struct ' + clientName + "<'a, S: Serialization, T: Transportation> {");
1845
- this_1.x(" pub serialization: &'a S,");
1846
- this_1.x(" pub transportation: &'a T,");
1847
- this_1.x('}');
1848
- this_1.x("impl<'a, S: Serialization, T: Transportation> " + namespacePath + '::Call for ' + clientName + "<'a, S, T> {");
1849
- this_1.x(' async fn ' + methodName + '(&self' + paramsStr + ') -> ' + endpointModuleName + '::Response {');
1850
- this_1.x(' let request = ' + requestConstruction + ';');
1851
- this_1.x(' let raw_request = ' + namespacePath + '::to_raw_request(self.serialization, request);');
1852
- this_1.x(' let raw_response = self.transportation.transport(&raw_request).await;');
1853
- this_1.x(' ' + namespacePath + '::from_raw_response(self.serialization, raw_response)');
1854
- this_1.x(' }');
1855
- this_1.x('}');
1856
- var tmp$ret$8 = this_1.o5();
1857
- var code = joinToString(tmp$ret$8, '\n');
1858
- var subPackageName = plus_2(this.g1z_1, 'client');
1859
- var tmp = Companion_getInstance().m1h(subPackageName.or() + toSnakeCase(this, clientName));
1860
- // Inline function 'kotlin.collections.buildList' call
1861
- // Inline function 'kotlin.collections.buildListInternal' call
1862
- // Inline function 'kotlin.apply' call
1863
- var this_2 = ArrayList_init_$Create$();
1864
- this_2.x(import_0('super::super::wirespec', '*'));
1865
- this_2.x(import_0('super::super::endpoint', endpointModuleName));
1866
- this_2.e1(modelImports);
1867
- this_2.x(new RawElement(code));
1868
- var tmp$ret$12 = this_2.o5();
1869
- return new File(tmp, tmp$ret$12);
1870
- };
1871
- protoOf(RustIrEmitter).p1u = function (endpoints, logger) {
1872
- logger.sq('Emitting main Client for ' + endpoints.a1() + ' endpoints');
1873
- var modDeclarations = joinToString(endpoints, '\n', VOID, VOID, VOID, VOID, RustIrEmitter$emitClient$lambda(this));
1874
- // Inline function 'kotlin.collections.flatMap' call
1875
- // Inline function 'kotlin.collections.flatMapTo' call
1876
- var destination = ArrayList_init_$Create$();
1877
- var _iterator__ex2g4s = endpoints.t();
1878
- while (_iterator__ex2g4s.u()) {
1879
- var element = _iterator__ex2g4s.v();
1880
- var list = importReferences(element);
1881
- addAll(destination, list);
1882
- }
1883
- // Inline function 'kotlin.collections.distinctBy' call
1884
- var set = HashSet_init_$Create$();
1885
- var list_0 = ArrayList_init_$Create$();
1886
- var _iterator__ex2g4s_0 = destination.t();
1887
- while (_iterator__ex2g4s_0.u()) {
1888
- var e = _iterator__ex2g4s_0.v();
1889
- var key = e.lu_1;
1890
- if (set.x(key)) {
1891
- list_0.x(e);
1892
- }
1893
- }
1894
- // Inline function 'kotlin.collections.filter' call
1895
- // Inline function 'kotlin.collections.filterTo' call
1896
- var destination_0 = ArrayList_init_$Create$();
1897
- var _iterator__ex2g4s_1 = list_0.t();
1898
- while (_iterator__ex2g4s_1.u()) {
1899
- var element_0 = _iterator__ex2g4s_1.v();
1900
- var tmp$ret$5;
1901
- $l$block_0: {
1902
- // Inline function 'kotlin.collections.none' call
1903
- var tmp;
1904
- if (isInterface(endpoints, Collection)) {
1905
- tmp = endpoints.r();
1906
- } else {
1907
- tmp = false;
1908
- }
1909
- if (tmp) {
1910
- tmp$ret$5 = true;
1911
- break $l$block_0;
1912
- }
1913
- var _iterator__ex2g4s_2 = endpoints.t();
1914
- while (_iterator__ex2g4s_2.u()) {
1915
- var element_1 = _iterator__ex2g4s_2.v();
1916
- if (element_1.ep_1.l1() === element_0.lu_1) {
1917
- tmp$ret$5 = false;
1918
- break $l$block_0;
1919
- }
1920
- }
1921
- tmp$ret$5 = true;
1922
- }
1923
- if (tmp$ret$5) {
1924
- destination_0.x(element_0);
1925
- }
1926
- }
1927
- // Inline function 'kotlin.collections.map' call
1928
- // Inline function 'kotlin.collections.mapTo' call
1929
- var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_0, 10));
1930
- var _iterator__ex2g4s_3 = destination_0.t();
1931
- while (_iterator__ex2g4s_3.u()) {
1932
- var item = _iterator__ex2g4s_3.v();
1933
- var tmp$ret$10 = import_0('super::model::' + toSnakeCase(this, item.lu_1), item.lu_1);
1934
- destination_1.x(tmp$ret$10);
1935
- }
1936
- var modelImports = destination_1;
1937
- // Inline function 'kotlin.collections.flatMap' call
1938
- // Inline function 'kotlin.collections.flatMapTo' call
1939
- var destination_2 = ArrayList_init_$Create$();
1940
- var _iterator__ex2g4s_4 = endpoints.t();
1941
- while (_iterator__ex2g4s_4.u()) {
1942
- var element_2 = _iterator__ex2g4s_4.v();
1943
- var endpointModuleName = toSnakeCase(this, element_2.ep_1.l1());
1944
- var clientModuleName = toSnakeCase(this, element_2.ep_1.l1() + 'Client');
1945
- var list_1 = listOf_0([import_0('super::endpoint', endpointModuleName), import_0(clientModuleName, element_2.ep_1.l1() + 'Client')]);
1946
- addAll(destination_2, list_1);
1947
- }
1948
- var endpointAndClientImports = destination_2;
1949
- // Inline function 'kotlin.collections.flatMap' call
1950
- // Inline function 'kotlin.collections.flatMapTo' call
1951
- var destination_3 = ArrayList_init_$Create$();
1952
- var _iterator__ex2g4s_5 = endpoints.t();
1953
- while (_iterator__ex2g4s_5.u()) {
1954
- var element_3 = _iterator__ex2g4s_5.v();
1955
- var endpointName = element_3.ep_1.l1();
1956
- var endpointModuleName_0 = toSnakeCase(this, endpointName);
1957
- var namespacePath = endpointModuleName_0 + '::' + endpointName;
1958
- var methodName = toSnakeCase(this, endpointName);
1959
- var _destruct__k2r9zo = buildClientParams(this, element_3);
1960
- var paramsStr = _destruct__k2r9zo.ne();
1961
- var callArgs = _destruct__k2r9zo.oe();
1962
- var tmp_0;
1963
- // Inline function 'kotlin.text.isNotEmpty' call
1964
- if (charSequenceLength(callArgs) > 0) {
1965
- tmp_0 = endpointName + 'Client { serialization: &self.serialization, transportation: &self.transportation }\n .' + methodName + '(' + callArgs + ').await';
1966
- } else {
1967
- tmp_0 = endpointName + 'Client { serialization: &self.serialization, transportation: &self.transportation }\n .' + methodName + '().await';
1968
- }
1969
- var delegateCall = tmp_0;
1970
- var list_2 = listOf_0(['impl<S: Serialization, T: Transportation> ' + namespacePath + '::Call for Client<S, T> {', ' async fn ' + methodName + '(&self' + paramsStr + ') -> ' + endpointModuleName_0 + '::Response {', ' ' + delegateCall, ' }', '}']);
1971
- addAll(destination_3, list_2);
1972
- }
1973
- var implBlocks = destination_3;
1974
- var code = joinToString(plus(listOf_0(['pub struct Client<S: Serialization, T: Transportation> {', ' pub serialization: S,', ' pub transportation: T,', '}']), implBlocks), '\n');
1975
- var tmp_1 = Companion_getInstance().m1h(this.g1z_1.or() + 'client');
1976
- // Inline function 'kotlin.collections.buildList' call
1977
- // Inline function 'kotlin.collections.buildListInternal' call
1978
- // Inline function 'kotlin.apply' call
1979
- var this_0 = ArrayList_init_$Create$();
1980
- this_0.x(new RawElement(modDeclarations));
1981
- this_0.x(import_0('super::wirespec', '*'));
1982
- this_0.e1(modelImports);
1983
- this_0.e1(endpointAndClientImports);
1984
- this_0.x(new RawElement(code));
1985
- var tmp$ret$23 = this_0.o5();
1986
- return new File(tmp_1, tmp$ret$23);
1987
- };
1988
- var properties_initialized_RustIrEmitter_kt_scscwh;
1989
- function _init_properties_RustIrEmitter_kt__j995rl() {
1990
- if (!properties_initialized_RustIrEmitter_kt_scscwh) {
1991
- properties_initialized_RustIrEmitter_kt_scscwh = true;
1992
- selfParam = new Parameter(Companion_getInstance().m1h('&self'), new Custom(''));
1993
- RESPONSE_PATTERN = Regex_init_$Create$('Response(\\d+|Default)');
1862
+ var properties_initialized_RustIrTransformer_kt_hr6k9w;
1863
+ function _init_properties_RustIrTransformer_kt__rrvmwq() {
1864
+ if (!properties_initialized_RustIrTransformer_kt_hr6k9w) {
1865
+ properties_initialized_RustIrTransformer_kt_hr6k9w = true;
1866
+ rustSelfParam = new Parameter(Companion_getInstance().l1h('&self'), new Custom(''));
1867
+ rustResponsePattern = Regex_init_$Create$('Response(\\d+|Default)');
1994
1868
  }
1995
1869
  }
1996
1870
  function borrowParamsOf($this, fn) {
1997
1871
  // Inline function 'kotlin.collections.map' call
1998
- var this_0 = fn.v1j_1;
1872
+ var this_0 = fn.u1j_1;
1999
1873
  // Inline function 'kotlin.collections.mapTo' call
2000
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1874
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
2001
1875
  var _iterator__ex2g4s = this_0.t();
2002
1876
  while (_iterator__ex2g4s.u()) {
2003
1877
  var item = _iterator__ex2g4s.v();
2004
1878
  var tmp;
2005
- if (RustTransform_getInstance().y1z(item.v1n_1)) {
1879
+ if (RustTransform_getInstance().l1y(item.t1o_1)) {
2006
1880
  tmp = item;
2007
1881
  } else {
2008
- tmp = item.y1n(VOID, applyBorrowRule(RustTransform_getInstance(), item.w1n_1));
1882
+ tmp = item.w1o(VOID, applyBorrowRule(RustTransform_getInstance(), item.u1o_1));
2009
1883
  }
2010
1884
  var tmp$ret$0 = tmp;
2011
1885
  destination.x(tmp$ret$0);
2012
1886
  }
2013
- return fn.b1k(VOID, VOID, destination);
1887
+ return fn.a1k(VOID, VOID, destination);
2014
1888
  }
2015
1889
  function applyBorrowRule($this, type) {
2016
1890
  var tmp;
2017
1891
  if (type instanceof Nullable) {
2018
- tmp = new Nullable(applyBorrowRule($this, type.o1h_1));
1892
+ tmp = new Nullable(applyBorrowRule($this, type.n1h_1));
2019
1893
  } else {
2020
1894
  if (equals(type, String_instance)) {
2021
1895
  tmp = new Custom('&str');
2022
1896
  } else {
2023
1897
  if (type instanceof Custom) {
2024
- tmp = $this.a20(type) ? type : $this.z1z(type) ? borrowImpl(type) : type;
1898
+ tmp = $this.n1y(type) ? type : $this.m1y(type) ? borrowImpl(type) : type;
2025
1899
  } else {
2026
1900
  tmp = type;
2027
1901
  }
@@ -2033,12 +1907,12 @@ function toBorrowedRaw($this, _this__u8e3s4) {
2033
1907
  return new RawExpression('&' + toRawCode($this, _this__u8e3s4));
2034
1908
  }
2035
1909
  function sanitizeKeywords_0($this, _this__u8e3s4) {
2036
- return Companion_getInstance_0().o1z_1.u1(_this__u8e3s4) ? 'r#' + _this__u8e3s4 : _this__u8e3s4;
1910
+ return Companion_getInstance_0().b1y_1.u1(_this__u8e3s4) ? 'r#' + _this__u8e3s4 : _this__u8e3s4;
2037
1911
  }
2038
1912
  function toRawCode($this, _this__u8e3s4) {
2039
1913
  var tmp;
2040
1914
  if (_this__u8e3s4 instanceof VariableReference) {
2041
- tmp = sanitizeKeywords_0($this, _this__u8e3s4.u1o_1.y1l());
1915
+ tmp = sanitizeKeywords_0($this, _this__u8e3s4.f1o_1.x1l());
2042
1916
  } else {
2043
1917
  if (_this__u8e3s4 instanceof FieldCall) {
2044
1918
  var tmp1_safe_receiver = _this__u8e3s4.i1p_1;
@@ -2051,20 +1925,20 @@ function toRawCode($this, _this__u8e3s4) {
2051
1925
  }
2052
1926
  var tmp2_elvis_lhs = tmp_0;
2053
1927
  var recv = tmp2_elvis_lhs == null ? '' : tmp2_elvis_lhs;
2054
- tmp = recv + sanitizeKeywords_0($this, _this__u8e3s4.j1p_1.y1l());
1928
+ tmp = recv + sanitizeKeywords_0($this, _this__u8e3s4.j1p_1.x1l());
2055
1929
  } else {
2056
1930
  if (_this__u8e3s4 instanceof ArrayIndexCall) {
2057
- var tmp_1 = _this__u8e3s4.m1q_1;
2058
- var lit = tmp_1 instanceof Literal ? tmp_1 : null;
1931
+ var tmp_1 = _this__u8e3s4.g1q_1;
1932
+ var lit = tmp_1 instanceof Literal_0 ? tmp_1 : null;
2059
1933
  var tmp_2;
2060
1934
  var tmp_3;
2061
1935
  if (!(lit == null)) {
2062
1936
  var tmp_4;
2063
- var tmp_5 = lit.e1p_1;
1937
+ var tmp_5 = lit.q1o_1;
2064
1938
  if (tmp_5 instanceof Integer) {
2065
1939
  tmp_4 = true;
2066
1940
  } else {
2067
- var tmp_6 = lit.e1p_1;
1941
+ var tmp_6 = lit.q1o_1;
2068
1942
  tmp_4 = tmp_6 instanceof Number_0;
2069
1943
  }
2070
1944
  tmp_3 = tmp_4;
@@ -2072,30 +1946,30 @@ function toRawCode($this, _this__u8e3s4) {
2072
1946
  tmp_3 = false;
2073
1947
  }
2074
1948
  if (tmp_3) {
2075
- tmp_2 = toString_0(lit.d1p_1);
1949
+ tmp_2 = toString_0(lit.p1o_1);
2076
1950
  } else {
2077
1951
  var tmp_7;
2078
1952
  if (!(lit == null)) {
2079
- var tmp_8 = lit.e1p_1;
2080
- tmp_7 = tmp_8 instanceof String_0;
1953
+ var tmp_8 = lit.q1o_1;
1954
+ tmp_7 = tmp_8 instanceof String_1;
2081
1955
  } else {
2082
1956
  tmp_7 = false;
2083
1957
  }
2084
1958
  if (tmp_7) {
2085
- tmp_2 = '"' + toString_0(lit.d1p_1) + '"';
1959
+ tmp_2 = '"' + toString_0(lit.p1o_1) + '"';
2086
1960
  } else {
2087
- tmp_2 = toRawCode($this, _this__u8e3s4.m1q_1);
1961
+ tmp_2 = toRawCode($this, _this__u8e3s4.g1q_1);
2088
1962
  }
2089
1963
  }
2090
1964
  var idx = tmp_2;
2091
- tmp = toRawCode($this, _this__u8e3s4.l1q_1) + '[' + idx + ']';
1965
+ tmp = toRawCode($this, _this__u8e3s4.f1q_1) + '[' + idx + ']';
2092
1966
  } else {
2093
1967
  if (_this__u8e3s4 instanceof ConstructorStatement) {
2094
- var tmp_9 = _this__u8e3s4.p1m_1;
1968
+ var tmp_9 = _this__u8e3s4.o1m_1;
2095
1969
  var tmp3_safe_receiver = tmp_9 instanceof Custom ? tmp_9 : null;
2096
- var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.q1h_1;
2097
- var typeName = tmp4_elvis_lhs == null ? toString_0(_this__u8e3s4.p1m_1) : tmp4_elvis_lhs;
2098
- var tmp_10 = _this__u8e3s4.q1m_1.j1();
1970
+ var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.p1h_1;
1971
+ var typeName = tmp4_elvis_lhs == null ? toString_0(_this__u8e3s4.o1m_1) : tmp4_elvis_lhs;
1972
+ var tmp_10 = _this__u8e3s4.p1m_1.j1();
2099
1973
  var args = joinToString(tmp_10, ', ', VOID, VOID, VOID, VOID, RustTransform$toRawCode$lambda);
2100
1974
  var tmp_11;
2101
1975
  // Inline function 'kotlin.text.isEmpty' call
@@ -2106,25 +1980,25 @@ function toRawCode($this, _this__u8e3s4) {
2106
1980
  }
2107
1981
  tmp = tmp_11;
2108
1982
  } else {
2109
- if (_this__u8e3s4 instanceof Literal) {
1983
+ if (_this__u8e3s4 instanceof Literal_0) {
2110
1984
  var tmp_12;
2111
- var tmp_13 = _this__u8e3s4.e1p_1;
2112
- if (tmp_13 instanceof String_0) {
2113
- tmp_12 = 'String::from("' + toString_0(_this__u8e3s4.d1p_1) + '")';
1985
+ var tmp_13 = _this__u8e3s4.q1o_1;
1986
+ if (tmp_13 instanceof String_1) {
1987
+ tmp_12 = 'String::from("' + toString_0(_this__u8e3s4.p1o_1) + '")';
2114
1988
  } else {
2115
- var tmp_14 = _this__u8e3s4.e1p_1;
1989
+ var tmp_14 = _this__u8e3s4.q1o_1;
2116
1990
  if (tmp_14 instanceof Boolean_0) {
2117
- tmp_12 = toString_0(_this__u8e3s4.d1p_1);
1991
+ tmp_12 = toString_0(_this__u8e3s4.p1o_1);
2118
1992
  } else {
2119
- var tmp_15 = _this__u8e3s4.e1p_1;
1993
+ var tmp_15 = _this__u8e3s4.q1o_1;
2120
1994
  if (tmp_15 instanceof Integer) {
2121
- tmp_12 = toString_0(_this__u8e3s4.d1p_1);
1995
+ tmp_12 = toString_0(_this__u8e3s4.p1o_1);
2122
1996
  } else {
2123
- var tmp_16 = _this__u8e3s4.e1p_1;
1997
+ var tmp_16 = _this__u8e3s4.q1o_1;
2124
1998
  if (tmp_16 instanceof Number_0) {
2125
- tmp_12 = toString_0(_this__u8e3s4.d1p_1);
1999
+ tmp_12 = toString_0(_this__u8e3s4.p1o_1);
2126
2000
  } else {
2127
- tmp_12 = toString_0(_this__u8e3s4.d1p_1);
2001
+ tmp_12 = toString_0(_this__u8e3s4.p1o_1);
2128
2002
  }
2129
2003
  }
2130
2004
  }
@@ -2132,7 +2006,7 @@ function toRawCode($this, _this__u8e3s4) {
2132
2006
  tmp = tmp_12;
2133
2007
  } else {
2134
2008
  if (_this__u8e3s4 instanceof RawExpression) {
2135
- tmp = _this__u8e3s4.c1p_1;
2009
+ tmp = _this__u8e3s4.h1o_1;
2136
2010
  } else {
2137
2011
  var message = 'Unsupported expression type in toRawCode: ' + getKClassFromExpression(_this__u8e3s4).o();
2138
2012
  throw IllegalStateException_init_$Create$(toString_0(message));
@@ -2177,13 +2051,13 @@ function RustTransform$borrow$lambda(element, tr) {
2177
2051
  var tmp;
2178
2052
  if (element instanceof Interface) {
2179
2053
  var tmp_0;
2180
- if (element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
2054
+ if (element.j1n_1.equals(Companion_getInstance().l1h('Call'))) {
2181
2055
  tmp_0 = element;
2182
2056
  } else {
2183
2057
  // Inline function 'kotlin.collections.map' call
2184
- var this_0 = element.n1o_1;
2058
+ var this_0 = element.k1n_1;
2185
2059
  // Inline function 'kotlin.collections.mapTo' call
2186
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
2060
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
2187
2061
  var _iterator__ex2g4s = this_0.t();
2188
2062
  while (_iterator__ex2g4s.u()) {
2189
2063
  var item = _iterator__ex2g4s.v();
@@ -2197,14 +2071,14 @@ function RustTransform$borrow$lambda(element, tr) {
2197
2071
  destination.x(tmp$ret$0);
2198
2072
  }
2199
2073
  var borrowed = destination;
2200
- tmp_0 = transformChildren(element.t1o(VOID, borrowed), tr);
2074
+ tmp_0 = transformChildren_0(element.q1n(VOID, borrowed), tr);
2201
2075
  }
2202
2076
  tmp = tmp_0;
2203
2077
  } else {
2204
2078
  if (element instanceof Function) {
2205
- tmp = transformChildren(borrowParamsOf(RustTransform_getInstance(), element), tr);
2079
+ tmp = transformChildren_0(borrowParamsOf(RustTransform_getInstance(), element), tr);
2206
2080
  } else {
2207
- tmp = transformChildren(element, tr);
2081
+ tmp = transformChildren_0(element, tr);
2208
2082
  }
2209
2083
  }
2210
2084
  return tmp;
@@ -2213,15 +2087,15 @@ function RustTransform$serializationArgs$lambda(s, t) {
2213
2087
  var tmp;
2214
2088
  var tmp_0;
2215
2089
  if (s instanceof FunctionCall) {
2216
- tmp_0 = RustTransform_getInstance().t1z_1.u1(s.b1m_1.y1l());
2090
+ tmp_0 = RustTransform_getInstance().g1y_1.u1(s.a1m_1.x1l());
2217
2091
  } else {
2218
2092
  tmp_0 = false;
2219
2093
  }
2220
2094
  if (tmp_0) {
2221
2095
  // Inline function 'kotlin.collections.mapIndexed' call
2222
- var this_0 = s.c1m_1.j1();
2096
+ var this_0 = s.b1m_1.j1();
2223
2097
  // Inline function 'kotlin.collections.mapIndexedTo' call
2224
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
2098
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
2225
2099
  var index = 0;
2226
2100
  var _iterator__ex2g4s = this_0.t();
2227
2101
  while (_iterator__ex2g4s.u()) {
@@ -2233,13 +2107,13 @@ function RustTransform$serializationArgs$lambda(s, t) {
2233
2107
  var key = item.k1();
2234
2108
  // Inline function 'kotlin.collections.component2' call
2235
2109
  var value = item.l1();
2236
- var transformed = t.u1t(value);
2110
+ var transformed = t.r1t(value);
2237
2111
  var tmp_1;
2238
2112
  var tmp_2;
2239
2113
  if (idx === 0) {
2240
2114
  var tmp_3;
2241
2115
  if (transformed instanceof VariableReference) {
2242
- tmp_3 = transformed.u1o_1.s1h() === 'it';
2116
+ tmp_3 = transformed.f1o_1.r1h() === 'it';
2243
2117
  } else {
2244
2118
  tmp_3 = false;
2245
2119
  }
@@ -2256,17 +2130,17 @@ function RustTransform$serializationArgs$lambda(s, t) {
2256
2130
  destination.x(tmp$ret$2);
2257
2131
  }
2258
2132
  var newArgs = toMap(destination);
2259
- tmp = s.f1m(VOID, VOID, VOID, newArgs);
2133
+ tmp = s.e1m(VOID, VOID, VOID, newArgs);
2260
2134
  } else {
2261
- tmp = transformChildren_0(s, t);
2135
+ tmp = transformChildren(s, t);
2262
2136
  }
2263
2137
  return tmp;
2264
2138
  }
2265
2139
  function RustTransform$rustName$lambda(it) {
2266
- return RustTransform_getInstance().x1z(it);
2140
+ return RustTransform_getInstance().j1y(it);
2267
2141
  }
2268
2142
  function RustTransform$toRawCode$lambda(it) {
2269
- return it.k1().y1l() + ': ' + toRawCode(RustTransform_getInstance(), it.l1());
2143
+ return it.k1().x1l() + ': ' + toRawCode(RustTransform_getInstance(), it.l1());
2270
2144
  }
2271
2145
  function RustTransform() {
2272
2146
  RustTransform_instance = this;
@@ -2274,57 +2148,57 @@ function RustTransform() {
2274
2148
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
2275
2149
  // Inline function 'kotlin.apply' call
2276
2150
  var this_0 = new TransformerBuilder();
2277
- this_0.f1u(RustTransform$primitivesToCustom$lambda);
2278
- tmp.q1z_1 = this_0.e1h();
2151
+ this_0.c1u(RustTransform$primitivesToCustom$lambda);
2152
+ tmp.d1y_1 = this_0.d1h();
2279
2153
  var tmp_0 = this;
2280
2154
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
2281
2155
  // Inline function 'kotlin.apply' call
2282
2156
  var this_1 = new TransformerBuilder();
2283
- this_1.d1h(RustTransform$borrow$lambda);
2284
- tmp_0.r1z_1 = this_1.e1h();
2157
+ this_1.c1h(RustTransform$borrow$lambda);
2158
+ tmp_0.e1y_1 = this_1.d1h();
2285
2159
  var tmp_1 = this;
2286
2160
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
2287
2161
  // Inline function 'kotlin.apply' call
2288
- tmp_1.s1z_1 = (new TransformerBuilder()).e1h();
2289
- this.t1z_1 = setOf(['serialize_path', 'serialize_param', 'serialize_body', 'deserialize_path', 'deserialize_param', 'deserialize_body']);
2162
+ tmp_1.f1y_1 = (new TransformerBuilder()).d1h();
2163
+ this.g1y_1 = setOf(['serialize_path', 'serialize_param', 'serialize_body', 'deserialize_path', 'deserialize_param', 'deserialize_body']);
2290
2164
  var tmp_2 = this;
2291
2165
  // Inline function 'community.flock.wirespec.ir.core.transformer' call
2292
2166
  // Inline function 'kotlin.apply' call
2293
2167
  var this_2 = new TransformerBuilder();
2294
- this_2.i1u(RustTransform$serializationArgs$lambda);
2295
- tmp_2.u1z_1 = this_2.e1h();
2296
- this.v1z_1 = setOf(['i32', 'i64', 'f32', 'f64', 'bool', 'u8', 'u16', 'u32', 'u64', 'usize', 'isize', '()']);
2168
+ this_2.f1u(RustTransform$serializationArgs$lambda);
2169
+ tmp_2.h1y_1 = this_2.d1h();
2170
+ this.i1y_1 = setOf(['i32', 'i64', 'f32', 'f64', 'bool', 'u8', 'u16', 'u32', 'u64', 'usize', 'isize', '()']);
2297
2171
  }
2298
- protoOf(RustTransform).w1z = function (element) {
2172
+ protoOf(RustTransform).k1y = function (element) {
2299
2173
  // Inline function 'community.flock.wirespec.ir.core.transform' call
2300
2174
  var scope = new TransformScope(element);
2301
- scope.e1u(RustTransform_getInstance().q1z_1);
2302
- var tmp = scope.z1t_1;
2175
+ scope.b1u(RustTransform_getInstance().d1y_1);
2176
+ var tmp = scope.w1t_1;
2303
2177
  // Inline function 'community.flock.wirespec.ir.core.transform' call
2304
2178
  var this_0 = isInterface(tmp, Element) ? tmp : THROW_CCE();
2305
2179
  var scope_0 = new TransformScope(this_0);
2306
- scope_0.e1u(RustTransform_getInstance().r1z_1);
2307
- var tmp_0 = scope_0.z1t_1;
2180
+ scope_0.b1u(RustTransform_getInstance().e1y_1);
2181
+ var tmp_0 = scope_0.w1t_1;
2308
2182
  // Inline function 'community.flock.wirespec.ir.core.transform' call
2309
2183
  var this_1 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
2310
2184
  var scope_1 = new TransformScope(this_1);
2311
- scope_1.e1u(RustTransform_getInstance().s1z_1);
2312
- var tmp_1 = scope_1.z1t_1;
2185
+ scope_1.b1u(RustTransform_getInstance().f1y_1);
2186
+ var tmp_1 = scope_1.w1t_1;
2313
2187
  // Inline function 'community.flock.wirespec.ir.core.transform' call
2314
2188
  var this_2 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
2315
2189
  var scope_2 = new TransformScope(this_2);
2316
- scope_2.e1u(RustTransform_getInstance().u1z_1);
2317
- var tmp_2 = scope_2.z1t_1;
2190
+ scope_2.b1u(RustTransform_getInstance().h1y_1);
2191
+ var tmp_2 = scope_2.w1t_1;
2318
2192
  return isInterface(tmp_2, Element) ? tmp_2 : THROW_CCE();
2319
2193
  };
2320
- protoOf(RustTransform).x1z = function (_this__u8e3s4) {
2194
+ protoOf(RustTransform).j1y = function (_this__u8e3s4) {
2321
2195
  var tmp;
2322
2196
  if (_this__u8e3s4 instanceof Custom) {
2323
2197
  var tmp_0;
2324
- if (_this__u8e3s4.r1h_1.r()) {
2325
- tmp_0 = _this__u8e3s4.q1h_1;
2198
+ if (_this__u8e3s4.q1h_1.r()) {
2199
+ tmp_0 = _this__u8e3s4.p1h_1;
2326
2200
  } else {
2327
- tmp_0 = _this__u8e3s4.q1h_1 + '<' + joinToString(_this__u8e3s4.r1h_1, ', ', VOID, VOID, VOID, VOID, RustTransform$rustName$lambda) + '>';
2201
+ tmp_0 = _this__u8e3s4.p1h_1 + '<' + joinToString(_this__u8e3s4.q1h_1, ', ', VOID, VOID, VOID, VOID, RustTransform$rustName$lambda) + '>';
2328
2202
  }
2329
2203
  tmp = tmp_0;
2330
2204
  } else {
@@ -2332,13 +2206,13 @@ protoOf(RustTransform).x1z = function (_this__u8e3s4) {
2332
2206
  tmp = 'String';
2333
2207
  } else {
2334
2208
  if (_this__u8e3s4 instanceof Nullable) {
2335
- tmp = 'Option<' + this.x1z(_this__u8e3s4.o1h_1) + '>';
2209
+ tmp = 'Option<' + this.j1y(_this__u8e3s4.n1h_1) + '>';
2336
2210
  } else {
2337
2211
  if (_this__u8e3s4 instanceof Array_0) {
2338
- tmp = 'Vec<' + this.x1z(_this__u8e3s4.p1h_1) + '>';
2212
+ tmp = 'Vec<' + this.j1y(_this__u8e3s4.o1h_1) + '>';
2339
2213
  } else {
2340
2214
  if (_this__u8e3s4 instanceof Dict) {
2341
- tmp = 'std::collections::HashMap<' + this.x1z(_this__u8e3s4.j1m_1) + ', ' + this.x1z(_this__u8e3s4.k1m_1) + '>';
2215
+ tmp = 'std::collections::HashMap<' + this.j1y(_this__u8e3s4.i1m_1) + ', ' + this.j1y(_this__u8e3s4.j1m_1) + '>';
2342
2216
  } else {
2343
2217
  if (equals(_this__u8e3s4, Any_instance)) {
2344
2218
  tmp = 'Box<dyn std::any::Any>';
@@ -2346,7 +2220,7 @@ protoOf(RustTransform).x1z = function (_this__u8e3s4) {
2346
2220
  if (equals(_this__u8e3s4, Bytes_instance)) {
2347
2221
  tmp = 'Vec<u8>';
2348
2222
  } else {
2349
- if (equals(_this__u8e3s4, Unit_instance)) {
2223
+ if (equals(_this__u8e3s4, Unit_instance_0)) {
2350
2224
  tmp = '()';
2351
2225
  } else {
2352
2226
  if (equals(_this__u8e3s4, Boolean_instance)) {
@@ -2360,7 +2234,7 @@ protoOf(RustTransform).x1z = function (_this__u8e3s4) {
2360
2234
  } else {
2361
2235
  if (_this__u8e3s4 instanceof Integer) {
2362
2236
  var tmp_1;
2363
- switch (_this__u8e3s4.g1m_1.b3_1) {
2237
+ switch (_this__u8e3s4.f1m_1.b3_1) {
2364
2238
  case 0:
2365
2239
  tmp_1 = 'i32';
2366
2240
  break;
@@ -2375,7 +2249,7 @@ protoOf(RustTransform).x1z = function (_this__u8e3s4) {
2375
2249
  } else {
2376
2250
  if (_this__u8e3s4 instanceof Number_0) {
2377
2251
  var tmp_2;
2378
- switch (_this__u8e3s4.h1m_1.b3_1) {
2252
+ switch (_this__u8e3s4.g1m_1.b3_1) {
2379
2253
  case 0:
2380
2254
  tmp_2 = 'f32';
2381
2255
  break;
@@ -2412,20 +2286,20 @@ protoOf(RustTransform).x1z = function (_this__u8e3s4) {
2412
2286
  }
2413
2287
  return tmp;
2414
2288
  };
2415
- protoOf(RustTransform).a20 = function (_this__u8e3s4) {
2289
+ protoOf(RustTransform).n1y = function (_this__u8e3s4) {
2416
2290
  var tmp;
2417
2291
  if (_this__u8e3s4 instanceof Custom) {
2418
- tmp = startsWith(_this__u8e3s4.q1h_1, '&') || startsWith(_this__u8e3s4.q1h_1, '&dyn ') || startsWith(_this__u8e3s4.q1h_1, '&impl ') || startsWith(_this__u8e3s4.q1h_1, '&mut ');
2292
+ tmp = startsWith(_this__u8e3s4.p1h_1, '&') || startsWith(_this__u8e3s4.p1h_1, '&dyn ') || startsWith(_this__u8e3s4.p1h_1, '&impl ') || startsWith(_this__u8e3s4.p1h_1, '&mut ');
2419
2293
  } else {
2420
2294
  tmp = false;
2421
2295
  }
2422
2296
  return tmp;
2423
2297
  };
2424
- protoOf(RustTransform).z1z = function (_this__u8e3s4) {
2425
- return _this__u8e3s4.q1h_1 === 'Serializer' || _this__u8e3s4.q1h_1 === 'Deserializer';
2298
+ protoOf(RustTransform).m1y = function (_this__u8e3s4) {
2299
+ return _this__u8e3s4.p1h_1 === 'Serializer' || _this__u8e3s4.p1h_1 === 'Deserializer';
2426
2300
  };
2427
- protoOf(RustTransform).y1z = function (_this__u8e3s4) {
2428
- var v = _this__u8e3s4.s1h();
2301
+ protoOf(RustTransform).l1y = function (_this__u8e3s4) {
2302
+ var v = _this__u8e3s4.r1h();
2429
2303
  switch (v) {
2430
2304
  case 'self':
2431
2305
  case '&self':
@@ -2441,13 +2315,13 @@ function RustTransform_getInstance() {
2441
2315
  return RustTransform_instance;
2442
2316
  }
2443
2317
  function borrow(_this__u8e3s4) {
2444
- return _this__u8e3s4.n1m('&' + _this__u8e3s4.q1h_1);
2318
+ return _this__u8e3s4.m1m('&' + _this__u8e3s4.p1h_1);
2445
2319
  }
2446
2320
  function borrowDyn(_this__u8e3s4) {
2447
- return _this__u8e3s4.n1m('&dyn ' + _this__u8e3s4.q1h_1);
2321
+ return _this__u8e3s4.m1m('&dyn ' + _this__u8e3s4.p1h_1);
2448
2322
  }
2449
2323
  function borrowImpl(_this__u8e3s4) {
2450
- return _this__u8e3s4.n1m('&impl ' + _this__u8e3s4.q1h_1);
2324
+ return _this__u8e3s4.m1m('&impl ' + _this__u8e3s4.p1h_1);
2451
2325
  }
2452
2326
  //region block: post-declaration
2453
2327
  protoOf(RustIrEmitter).on = emit_1;