Skip to content

Commit b2c1f7a

Browse files
committed
Format
1 parent 7552d6e commit b2c1f7a

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

jscomp/frontend/ast_external_process.ml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,26 @@ type response = {
349349
no_inline_cross_module: bool;
350350
}
351351

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)
358372

359373
let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
360374
(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)
406420
Location.raise_errorf ~loc
407421
"expect label, optional, or unit here")
408422
| 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
412427
in
413428
let obj_arg_type = refine_obj_arg_type ~nolabel:false ty in
414429
match obj_arg_type with
@@ -465,9 +480,10 @@ let process_obj (loc : Location.t) (st : external_desc) (prim_name : string)
465480
Location.raise_errorf ~loc
466481
"%@obj label %s does not support %@unwrap arguments" label)
467482
| 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
471487
in
472488
let obj_arg_type = get_opt_arg_type ~nolabel:false ty in
473489
match obj_arg_type with

jscomp/gentype/TranslateStructure.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ let rec addAnnotationsToTypes_ ~config ~(expr : Typedtree.expression)
1111
let aName =
1212
if aName = "*opt*" then
1313
match arg_label with
14-
| Optional l ->
15-
l
14+
| Optional l -> l
1615
| _ -> "" (* should not happen *)
1716
else aName
1817
in

0 commit comments

Comments
 (0)