Skip to content

Commit 04c3010

Browse files
committed
cleanup
1 parent f35567d commit 04c3010

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

jscomp/gentype/GenTypeCommon.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ and variant = {
9999
unboxed: bool;
100100
}
101101

102-
and payload = {case: case; inlineRecord: bool [@live]; numArgs: int; [@live] t: type_}
102+
and payload = {
103+
case: case;
104+
inlineRecord: bool; [@live]
105+
numArgs: int; [@live]
106+
t: type_;
107+
}
103108

104109
type label = Nolabel | Label of string | OptLabel of string
105110

jscomp/ml/typedecl.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ let make_constructor env type_path type_params sargs sret_type =
290290
*)
291291

292292

293-
let transl_declaration ~foundObject env sdecl id =
293+
let transl_declaration ~typeRecordAsObject env sdecl id =
294294
(* Bind type parameters *)
295295
reset_type_variables();
296296
Ctype.begin_def ();
@@ -481,8 +481,8 @@ let transl_declaration ~foundObject env sdecl id =
481481
check_duplicates lbls StringSet.empty;
482482
Ttype_record lbls, Type_record(lbls', rep), sdecl
483483
| None ->
484-
(* Could not fine type decl for ...t: assume t is an object type and this is syntax ambiguity *)
485-
foundObject := true;
484+
(* Could not find record type decl for ...t: assume t is an object type and this is syntax ambiguity *)
485+
typeRecordAsObject := true;
486486
let fields = Ext_list.map lbls_ (fun ld ->
487487
match ld.pld_name.txt with
488488
| "..." -> Parsetree.Oinherit ld.pld_type
@@ -602,7 +602,7 @@ let check_constraints_labels env visited l pl =
602602
check_constraints_rec env (get_loc (Ident.name name) pl) visited ty)
603603
l
604604

605-
let check_constraints ~foundObject env sdecl (_, decl) =
605+
let check_constraints ~typeRecordAsObject env sdecl (_, decl) =
606606
let visited = ref TypeSet.empty in
607607
begin match decl.type_kind with
608608
| Type_abstract -> ()
@@ -651,7 +651,7 @@ let check_constraints ~foundObject env sdecl (_, decl) =
651651
begin match decl.type_manifest with
652652
| None -> ()
653653
| Some ty ->
654-
if not !foundObject then
654+
if not !typeRecordAsObject then
655655
let sty =
656656
match sdecl.ptype_manifest with Some sty -> sty | _ -> assert false
657657
in
@@ -1311,15 +1311,15 @@ let transl_type_decl env rec_flag sdecl_list =
13111311
| Asttypes.Recursive | Asttypes.Nonrecursive ->
13121312
id, None
13131313
in
1314-
let foundObject = ref false in
1314+
let typeRecordAsObject = ref false in
13151315
let transl_declaration name_sdecl (id, slot) =
13161316
current_slot := slot;
13171317
Builtin_attributes.warning_scope
13181318
name_sdecl.ptype_attributes
1319-
(fun () -> transl_declaration temp_env name_sdecl id)
1319+
(fun () -> transl_declaration ~typeRecordAsObject temp_env name_sdecl id)
13201320
in
13211321
let tdecls =
1322-
List.map2 (transl_declaration ~foundObject) sdecl_list (List.map id_slots id_list) in
1322+
List.map2 transl_declaration sdecl_list (List.map id_slots id_list) in
13231323
let decls =
13241324
List.map (fun tdecl -> (tdecl.typ_id, tdecl.typ_type)) tdecls in
13251325
current_slot := None;
@@ -1367,7 +1367,7 @@ let transl_type_decl env rec_flag sdecl_list =
13671367
| None -> ())
13681368
sdecl_list tdecls;
13691369
(* Check that constraints are enforced *)
1370-
List.iter2 (check_constraints ~foundObject newenv) sdecl_list decls;
1370+
List.iter2 (check_constraints ~typeRecordAsObject newenv) sdecl_list decls;
13711371
(* Name recursion *)
13721372
let decls =
13731373
List.map2 (fun sdecl (id, decl) -> id, name_recursion sdecl id decl)

0 commit comments

Comments
 (0)