@@ -9,8 +9,7 @@ open Parsetree;
9
9
open Generator_utils ;
10
10
open Output_native_utils ;
11
11
12
- let const_str_expr = s =>
13
- Ast_helper . (Exp . constant([@ implicit_arity ] Pconst_string (s, None )));
12
+ let const_str_expr = s => Ast_helper . (Exp . constant(Pconst_string (s, None )));
14
13
15
14
let make_error_raiser = message =>
16
15
if (Ppx_config . verbose_error_handling() ) {
@@ -82,7 +81,7 @@ let generate_poly_enum_decoder = (loc, enum_meta) => {
82
81
List . map(
83
82
({evm_name, _}) =>
84
83
Exp . case(
85
- Pat . constant([ @ implicit_arity ] Pconst_string (evm_name, None )),
84
+ Pat . constant(Pconst_string (evm_name, None )),
86
85
Exp . variant(evm_name, None ),
87
86
),
88
87
enum_meta. em_values,
@@ -114,8 +113,7 @@ let generate_poly_enum_decoder = (loc, enum_meta) => {
114
113
Ast_helper . (
115
114
Typ . variant(
116
115
List . map(
117
- ({evm_name, _}) =>
118
- [@ implicit_arity ] Rtag ({txt: evm_name, loc}, [] , true , [] ),
116
+ ({evm_name, _}) => Rtag ({txt: evm_name, loc}, [] , true , [] ),
119
117
enum_meta. em_values,
120
118
),
121
119
Closed ,
@@ -154,53 +152,49 @@ let generate_error = (loc, message) => {
154
152
155
153
let rec generate_decoder = config =>
156
154
fun
157
- | [ @ implicit_arity ] Res_nullable (loc , inner ) =>
155
+ | Res_nullable (loc , inner ) =>
158
156
generate_nullable_decoder(config, conv_loc(loc), inner)
159
- | [ @ implicit_arity ] Res_array (loc , inner ) =>
157
+ | Res_array (loc , inner ) =>
160
158
generate_array_decoder(config, conv_loc(loc), inner)
161
159
| Res_id (loc ) => id_decoder(conv_loc(loc))
162
160
| Res_string (loc ) => string_decoder(conv_loc(loc))
163
161
| Res_int (loc ) => int_decoder(conv_loc(loc))
164
162
| Res_float (loc ) => float_decoder(conv_loc(loc))
165
163
| Res_boolean (loc ) => boolean_decoder(conv_loc(loc))
166
- | Res_raw_scalar (_loc ) => {
167
- % expr
168
- value;
169
- }
170
- | [@ implicit_arity ] Res_poly_enum (loc , enum_meta ) =>
164
+ | Res_raw_scalar (_loc ) => [% expr value]
165
+ | Res_poly_enum (loc , enum_meta ) =>
171
166
generate_poly_enum_decoder(conv_loc(loc), enum_meta)
172
- | [ @ implicit_arity ] Res_custom_decoder (loc , ident , inner ) =>
167
+ | Res_custom_decoder (loc , ident , inner ) =>
173
168
generate_custom_decoder(config, conv_loc(loc), ident, inner)
174
- | [ @ implicit_arity ] Res_record (loc , name , fields ) =>
169
+ | Res_record (loc , name , fields ) =>
175
170
generate_record_decoder(config, conv_loc(loc), name, fields)
176
- | [ @ implicit_arity ] Res_object (loc , name , fields ) =>
171
+ | Res_object (loc , name , fields ) =>
177
172
generate_object_decoder(config, conv_loc(loc), name, fields)
178
- | [ @ implicit_arity ] Res_poly_variant_selection_set (loc , name , fields ) =>
173
+ | Res_poly_variant_selection_set (loc , name , fields ) =>
179
174
generate_poly_variant_selection_set(config, conv_loc(loc), name, fields)
180
- | [ @ implicit_arity ] Res_poly_variant_union (loc , name , fragments , exhaustive ) =>
175
+ | Res_poly_variant_union (loc , name , fragments , exhaustive ) =>
181
176
generate_poly_variant_union(
182
177
config,
183
178
conv_loc(loc),
184
179
name,
185
180
fragments,
186
181
exhaustive,
187
182
)
188
- | [ @ implicit_arity ] Res_poly_variant_interface (loc , name , base , fragments ) =>
183
+ | Res_poly_variant_interface (loc , name , base , fragments ) =>
189
184
generate_poly_variant_interface(
190
185
config,
191
186
conv_loc(loc),
192
187
name,
193
188
base,
194
189
fragments,
195
190
)
196
- | [ @ implicit_arity ] Res_solo_fragment_spread (loc , name ) =>
191
+ | Res_solo_fragment_spread (loc , name ) =>
197
192
generate_solo_fragment_spread(conv_loc(loc), name)
198
- | [@ implicit_arity ] Res_error (loc , message ) =>
199
- generate_error(conv_loc(loc), message)
193
+ | Res_error (loc , message ) => generate_error(conv_loc(loc), message)
200
194
and generate_nullable_decoder = (config, loc, inner) =>
201
195
[@ metaloc loc]
202
196
(
203
- switch %expr (value) {
197
+ switch %expr (( value: Yojson . Basic . t ) ) {
204
198
| ` Null => None
205
199
| value => Some ([% e generate_decoder(config, inner)])
206
200
}
@@ -256,7 +250,7 @@ and generate_record_decoder = (config, loc, name, fields) => {
256
250
fields
257
251
|> filter_map(
258
252
fun
259
- | [ @ implicit_arity ] Fr_named_field (field , _ , _ ) =>
253
+ | Fr_named_field (field , _ , _ ) =>
260
254
Some (Pat . var({loc, txt: "field_" ++ field}))
261
255
| Fr_fragment_spread (_ ) => None ,
262
256
)
@@ -268,7 +262,7 @@ and generate_record_decoder = (config, loc, name, fields) => {
268
262
fields
269
263
|> filter_map(
270
264
fun
271
- | [ @ implicit_arity ] Fr_named_field (field , loc , inner ) => {
265
+ | Fr_named_field (field , loc , inner ) => {
272
266
let loc = conv_loc(loc);
273
267
[@ metaloc loc]
274
268
Some (
@@ -304,7 +298,7 @@ and generate_record_decoder = (config, loc, name, fields) => {
304
298
fields
305
299
|> List . map(
306
300
fun
307
- | [ @ implicit_arity ] Fr_named_field (field , loc , _ ) => {
301
+ | Fr_named_field (field , loc , _ ) => {
308
302
let loc = conv_loc(loc);
309
303
(
310
304
{Location . loc, txt: Longident . Lident (field)},
@@ -314,7 +308,7 @@ and generate_record_decoder = (config, loc, name, fields) => {
314
308
),
315
309
);
316
310
}
317
- | [ @ implicit_arity ] Fr_fragment_spread (field , loc , name ) => {
311
+ | Fr_fragment_spread (field , loc , name ) => {
318
312
let loc = conv_loc(loc);
319
313
(
320
314
{Location . loc, txt: Longident . Lident (field)},
@@ -359,11 +353,10 @@ and generate_object_decoder = (config, loc, name, fields) =>
359
353
Pat . any() ,
360
354
List . map(
361
355
fun
362
- | [ @ implicit_arity ] Fr_named_field (key , _ , inner ) =>
356
+ | Fr_named_field (key , _ , inner ) =>
363
357
Cf . method(
364
358
{txt: key, loc: Location . none},
365
359
Public ,
366
- [@ implicit_arity ]
367
360
Cfk_concrete (
368
361
Fresh ,
369
362
switch %expr (List . assoc([% e const_str_expr(key)], value)) {
@@ -388,12 +381,11 @@ and generate_object_decoder = (config, loc, name, fields) =>
388
381
},
389
382
),
390
383
)
391
- | [ @ implicit_arity ] Fr_fragment_spread (key , loc , name ) => {
384
+ | Fr_fragment_spread (key , loc , name ) => {
392
385
let loc = conv_loc(loc);
393
386
Cf . method(
394
387
{txt: key, loc: Location . none},
395
388
Public ,
396
- [@ implicit_arity ]
397
389
Cfk_concrete (
398
390
Fresh ,
399
391
{
@@ -462,7 +454,6 @@ and generate_poly_variant_selection_set = (config, loc, name, fields) => {
462
454
Typ . variant(
463
455
List . map(
464
456
((name, _)) =>
465
- [@ implicit_arity ]
466
457
Rtag (
467
458
{txt: Compat . capitalize_ascii(name), loc},
468
459
[] ,
@@ -506,14 +497,12 @@ and generate_poly_variant_interface = (config, loc, name, base, fragments) => {
506
497
507
498
let map_case = ((type_name, inner)) => {
508
499
open Ast_helper ;
509
- let name_pattern =
510
- Pat . constant([@ implicit_arity ] Pconst_string (type_name, None ));
500
+ let name_pattern = Pat . constant(Pconst_string (type_name, None ));
511
501
let variant =
512
502
Exp . variant(type_name, Some (generate_decoder(config, inner)));
513
503
Exp . case(name_pattern, variant);
514
504
};
515
505
let map_case_ty = ((name, _)) =>
516
- [@ implicit_arity ]
517
506
Rtag (
518
507
name,
519
508
[] ,
@@ -589,8 +578,7 @@ and generate_poly_variant_union =
589
578
Ast_helper . (
590
579
fragments
591
580
|> List . map(((type_name, inner)) => {
592
- let name_pattern =
593
- Pat . constant([@ implicit_arity ] Pconst_string (type_name, None ));
581
+ let name_pattern = Pat . constant(Pconst_string (type_name, None ));
594
582
let variant =
595
583
Ast_helper . (
596
584
Exp . variant(type_name, Some (generate_decoder(config, inner)))
@@ -617,16 +605,13 @@ and generate_poly_variant_union =
617
605
)
618
606
| Nonexhaustive => (
619
607
Exp . case(Pat . any() , [% expr ` Nonexhaustive ]),
620
- [
621
- [@ implicit_arity ] Rtag ({txt: "Nonexhaustive" , loc}, [] , true , [] ),
622
- ] ,
608
+ [ Rtag ({txt: "Nonexhaustive" , loc}, [] , true , [] )] ,
623
609
)
624
610
}
625
611
);
626
612
let fragment_case_tys =
627
613
List . map(
628
614
((name, _)) =>
629
- [@ implicit_arity ]
630
615
Rtag (
631
616
{txt: name, loc},
632
617
[] ,
0 commit comments