@@ -349,12 +349,26 @@ type response = {
349
349
no_inline_cross_module : bool ;
350
350
}
351
351
352
- let get_maybe_obj_field_alias (attributes ) =
353
- attributes |> List. find_map (fun (attr : Parsetree.attribute ) -> match attr with
354
- | ({txt = "as" ; _} , PStr [ { pstr_desc = Pstr_eval ({ pexp_desc = Pexp_constant (Pconst_string (alias , _ )); _} , _ ); _ } ]) -> Some (alias)
355
- | _ -> None
356
- )
357
-
352
+ let get_maybe_obj_field_alias attributes =
353
+ attributes
354
+ |> List. find_map (fun (attr : Parsetree.attribute ) ->
355
+ match attr with
356
+ | ( {txt = " as" ; _},
357
+ PStr
358
+ [
359
+ {
360
+ pstr_desc =
361
+ Pstr_eval
362
+ ( {
363
+ pexp_desc = Pexp_constant (Pconst_string (alias, _));
364
+ _;
365
+ },
366
+ _ );
367
+ _;
368
+ };
369
+ ] ) ->
370
+ Some alias
371
+ | _ -> None )
358
372
359
373
let process_obj (loc : Location.t ) (st : external_desc ) (prim_name : string )
360
374
(arg_types_ty : Ast_core_type.param_type list )
@@ -406,9 +420,10 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
406
420
Location. raise_errorf ~loc
407
421
" expect label, optional, or unit here" )
408
422
| Labelled label -> (
409
- let fieldName = match get_maybe_obj_field_alias param_type.attr with
410
- | Some (alias ) -> alias
411
- | None -> label
423
+ let fieldName =
424
+ match get_maybe_obj_field_alias param_type.attr with
425
+ | Some alias -> alias
426
+ | None -> label
412
427
in
413
428
let obj_arg_type = refine_obj_arg_type ~nolabel: false ty in
414
429
match obj_arg_type with
@@ -465,9 +480,10 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
465
480
Location. raise_errorf ~loc
466
481
" %@obj label %s does not support %@unwrap arguments" label)
467
482
| Optional label -> (
468
- let fieldName = match get_maybe_obj_field_alias param_type.attr with
469
- | Some (alias ) -> alias
470
- | None -> label
483
+ let fieldName =
484
+ match get_maybe_obj_field_alias param_type.attr with
485
+ | Some alias -> alias
486
+ | None -> label
471
487
in
472
488
let obj_arg_type = get_opt_arg_type ~nolabel: false ty in
473
489
match obj_arg_type with
0 commit comments