Skip to content

Commit 0959437

Browse files
committed
separate refine_obj_arg_type from refine_arg_type
1 parent 00d12ff commit 0959437

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

jscomp/syntax/ast_external_process.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ let refine_arg_type ~(nolabel:bool) (ptyp : Ast_core_type.t)
119119
else (* ([`a|`b] [@bs.string]) *)
120120
ptyp, spec_of_ptyp nolabel ptyp
121121

122-
122+
let refine_obj_arg_type = refine_arg_type
123123
(** Given the type of argument, process its [bs.] attribute and new type,
124124
The new type is currently used to reconstruct the external type
125125
and result type in [@@bs.obj]
@@ -409,14 +409,14 @@ let process_obj
409409
let new_arg_label, new_arg_types, output_tys =
410410
match arg_label with
411411
| Nolabel ->
412-
let new_ty, arg_type = refine_arg_type ~nolabel:true ty in
412+
let new_ty, arg_type = refine_obj_arg_type ~nolabel:true ty in
413413
if arg_type = Extern_unit then
414414
External_arg_spec.empty_kind arg_type,
415415
{param_type with ty = new_ty}::arg_types, result_types
416416
else
417417
Location.raise_errorf ~loc "expect label, optional, or unit here"
418418
| Labelled name ->
419-
let new_ty, obj_arg_type = refine_arg_type ~nolabel:false ty in
419+
let new_ty, obj_arg_type = refine_obj_arg_type ~nolabel:false ty in
420420
begin match obj_arg_type with
421421
| Ignore ->
422422
External_arg_spec.empty_kind obj_arg_type,
@@ -499,7 +499,8 @@ let process_obj
499499
if result_type.ptyp_desc = Ptyp_any then
500500
Ast_core_type.make_obj ~loc result_types
501501
else
502-
fst (refine_arg_type ~nolabel:true result_type)
502+
result_type
503+
(* TODO: do we need do some error checking here *)
503504
(* result type can not be labeled *)
504505
in
505506
Ast_compatible.mk_fn_type new_arg_types_ty result,

0 commit comments

Comments
 (0)