Skip to content

Commit 41420c6

Browse files
committed
convert missing cases
1 parent 1eacea0 commit 41420c6

17 files changed

+183
-183
lines changed

jscomp/gentype/Converter.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let type_get_inlined ~config ~lookup_id ~type_name_is_interface type0 =
3232
in
3333
let f type_var =
3434
match
35-
pairs |> List.find (fun (typeVar1, _) -> type_var = typeVar1)
35+
pairs |> List.find (fun (type_var1, _) -> type_var = type_var1)
3636
with
3737
| _, type_argument -> Some type_argument
3838
| exception Not_found -> None

jscomp/gentype/Dependencies.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ let rec handle_namespace ~name dep =
66
| Dot (External s, module_name) when s = name -> External module_name
77
| Dot (dep1, s) -> Dot (dep1 |> handle_namespace ~name, s)
88

9-
let rec fromPath1 ~config ~type_env (path : Path.t) =
9+
let rec from_path1 ~config ~type_env (path : Path.t) =
1010
match path with
1111
| Pident id -> (
1212
let name = id |> Ident.name in
1313
match type_env |> TypeEnv.lookup ~name with
1414
| None -> (type_env, External name)
15-
| Some typeEnv1 -> (
16-
let typeEnv2 =
15+
| Some type_env1 -> (
16+
let type_env2 =
1717
match type_env |> TypeEnv.get_module ~name with
18-
| Some typeEnv2 -> typeEnv2
19-
| None -> typeEnv1
18+
| Some type_env2 -> type_env2
19+
| None -> type_env1
2020
in
21-
match typeEnv1 |> TypeEnv.expand_alias_to_external_module ~name with
22-
| Some dep -> (typeEnv2, dep)
21+
match type_env1 |> TypeEnv.expand_alias_to_external_module ~name with
22+
| Some dep -> (type_env2, dep)
2323
| None ->
2424
let resolved_name =
25-
name |> TypeEnv.add_module_path ~type_env:typeEnv1
25+
name |> TypeEnv.add_module_path ~type_env:type_env1
2626
in
27-
(typeEnv2, Internal resolved_name)))
27+
(type_env2, Internal resolved_name)))
2828
| Pdot (Pident id, s, _pos)
2929
when id |> ScopedPackage.is_generated_module ~config ->
3030
( type_env,
3131
External (s |> ScopedPackage.add_generated_module ~generated_module:id) )
3232
| Pdot (p, s, _pos) -> (
33-
let type_env_from_p, dep = p |> fromPath1 ~config ~type_env in
33+
let type_env_from_p, dep = p |> from_path1 ~config ~type_env in
3434
match
3535
type_env_from_p |> TypeEnv.expand_alias_to_external_module ~name:s
3636
with
@@ -47,7 +47,7 @@ let rec is_internal dep =
4747
| Dot (d, _) -> d |> is_internal
4848

4949
let from_path ~config ~type_env path =
50-
let _, dep = path |> fromPath1 ~config ~type_env in
50+
let _, dep = path |> from_path1 ~config ~type_env in
5151
if !Debug.type_resolution then
5252
Log_.item "fromPath path:%s typeEnv:%s %s resolved:%s\n" (path |> Path.name)
5353
(type_env |> TypeEnv.to_string)

jscomp/gentype/EmitJs.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ let emit_translation_as_string ~config ~file_name
669669
in
670670
let f type_var =
671671
match
672-
pairs |> List.find (fun (typeVar1, _) -> type_var = typeVar1)
672+
pairs |> List.find (fun (type_var1, _) -> type_var = type_var1)
673673
with
674674
| _, type_argument -> Some type_argument
675675
| exception Not_found -> None

jscomp/gentype/GenTypeCommon.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ let string_t = ident "string"
195195
let unit_t = ident "void"
196196
let weakmap_t (x, y) = ident ~type_args:[x; y] "WeakMap"
197197
let weakset_t x = ident ~type_args:[x] "WeakSet"
198-
let int64T = Tuple [number_t; number_t]
198+
let int64_t = Tuple [number_t; number_t]
199199

200200
module NodeFilename = struct
201201
include Filename

jscomp/gentype/TranslateCoreType.ml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ let rec translate_arrow_type ~config ~type_vars_gen
5252
~no_function_return_dependencies ~type_env ~rev_arg_deps ~rev_args
5353
(core_type : Typedtree.core_type) =
5454
match core_type.ctyp_desc with
55-
| Ttyp_arrow (Nolabel, coreType1, coreType2) ->
55+
| Ttyp_arrow (Nolabel, core_type1, core_type2) ->
5656
let {dependencies; type_} =
57-
coreType1 |> fun __x ->
57+
core_type1 |> fun __x ->
5858
translateCoreType_ ~config ~type_vars_gen ~type_env __x
5959
in
6060
let next_rev_deps = List.rev_append dependencies rev_arg_deps in
61-
coreType2
61+
core_type2
6262
|> translate_arrow_type ~config ~type_vars_gen
6363
~no_function_return_dependencies ~type_env ~rev_arg_deps:next_rev_deps
6464
~rev_args:((Nolabel, type_) :: rev_args)
65-
| Ttyp_arrow (((Labelled lbl | Optional lbl) as label), coreType1, coreType2)
65+
| Ttyp_arrow (((Labelled lbl | Optional lbl) as label), core_type1, core_type2)
6666
-> (
6767
let as_label =
6868
match
@@ -71,13 +71,13 @@ let rec translate_arrow_type ~config ~type_vars_gen
7171
| Some s -> s
7272
| None -> ""
7373
in
74-
match coreType1 |> remove_option ~label with
74+
match core_type1 |> remove_option ~label with
7575
| None ->
7676
let {dependencies; type_ = type1} =
77-
coreType1 |> translateCoreType_ ~config ~type_vars_gen ~type_env
77+
core_type1 |> translateCoreType_ ~config ~type_vars_gen ~type_env
7878
in
7979
let next_rev_deps = List.rev_append dependencies rev_arg_deps in
80-
coreType2
80+
core_type2
8181
|> translate_arrow_type ~config ~type_vars_gen
8282
~no_function_return_dependencies ~type_env
8383
~rev_arg_deps:next_rev_deps
@@ -93,7 +93,7 @@ let rec translate_arrow_type ~config ~type_vars_gen
9393
t1 |> translateCoreType_ ~config ~type_vars_gen ~type_env
9494
in
9595
let next_rev_deps = List.rev_append dependencies rev_arg_deps in
96-
coreType2
96+
core_type2
9797
|> translate_arrow_type ~config ~type_vars_gen
9898
~no_function_return_dependencies ~type_env
9999
~rev_arg_deps:next_rev_deps
@@ -259,11 +259,11 @@ and translateCoreType_ ~config ~type_vars_gen
259259
|> List.map (fun (_, translation) -> translation.dependencies)
260260
|> List.flatten
261261
in
262-
let typeEnv1 = type_env |> TypeEnv.add_type_equations ~type_equations in
262+
let type_env1 = type_env |> TypeEnv.add_type_equations ~type_equations in
263263
let dependencies_from_record_type, type_ =
264264
signature.sig_type
265265
|> signature_to_module_runtime_representation ~config ~type_vars_gen
266-
~type_env:typeEnv1
266+
~type_env:type_env1
267267
in
268268
{
269269
dependencies =

jscomp/gentype/TranslateStructure.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let rec addAnnotationsToTypes_ ~config ~(expr : Typedtree.expression)
66
| ( Texp_function {arg_label; param; cases = [{c_rhs}]},
77
_,
88
{a_type} :: next_types ) ->
9-
let nextTypes1 = next_types |> addAnnotationsToTypes_ ~config ~expr:c_rhs in
9+
let next_types1 = next_types |> addAnnotationsToTypes_ ~config ~expr:c_rhs in
1010
let a_name = Ident.name param in
1111
let _ = Printtyped.implementation in
1212
let a_name =
@@ -16,7 +16,7 @@ let rec addAnnotationsToTypes_ ~config ~(expr : Typedtree.expression)
1616
| _ -> "" (* should not happen *)
1717
else a_name
1818
in
19-
{a_name; a_type} :: nextTypes1
19+
{a_name; a_type} :: next_types1
2020
| Texp_construct ({txt = Lident "Function$"}, _, [fun_expr]), _, _ ->
2121
(* let uncurried1: function$<_, _> = Function$(x => x |> string_of_int, [`Has_arity1]) *)
2222
addAnnotationsToTypes_ ~config ~expr:fun_expr arg_types
@@ -50,14 +50,14 @@ and add_annotations_to_fields ~config (expr : Typedtree.expression)
5050
match (expr.exp_desc, fields, arg_types) with
5151
| _, [], _ -> ([], arg_types |> add_annotations_to_types ~config ~expr)
5252
| Texp_function {cases = [{c_rhs}]}, field :: next_fields, _ ->
53-
let nextFields1, types1 =
53+
let next_fields1, types1 =
5454
add_annotations_to_fields ~config c_rhs next_fields arg_types
5555
in
5656
let name =
5757
TranslateTypeDeclarations.rename_record_field
5858
~attributes:expr.exp_attributes ~name:field.name_j_s
5959
in
60-
({field with name_j_s = name} :: nextFields1, types1)
60+
({field with name_j_s = name} :: next_fields1, types1)
6161
| _ -> (fields, arg_types)
6262
[@@live]
6363

@@ -321,7 +321,7 @@ and translate_structure_item ~config ~output_file_relative ~resolver ~type_env
321321
Tmod_structure
322322
{
323323
str_items =
324-
[({str_desc = Tstr_primitive _} as structItem1)];
324+
[({str_desc = Tstr_primitive _} as struct_item1)];
325325
};
326326
},
327327
_,
@@ -332,7 +332,7 @@ and translate_structure_item ~config ~output_file_relative ~resolver ~type_env
332332
};
333333
_;
334334
} ->
335-
structItem1
335+
struct_item1
336336
|> translate_structure_item ~config ~output_file_relative ~resolver
337337
~type_env
338338
| {str_desc = Tstr_include {incl_type = signature}} ->

jscomp/gentype/TranslateTypeExprFromTypes.ml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
7777
match (path |> path_to_list |> List.rev, params_translation) with
7878
| (["FB"; "bool"] | ["bool"]), [] -> {dependencies = []; type_ = boolean_t}
7979
| (["FB"; "int"] | ["int"]), [] -> {dependencies = []; type_ = number_t}
80-
| (["Int64"; "t"] | ["int64"]), [] -> {dependencies = []; type_ = int64T}
80+
| (["Int64"; "t"] | ["int64"]), [] -> {dependencies = []; type_ = int64_t}
8181
| (["FB"; "float"] | ["float"]), [] -> {dependencies = []; type_ = number_t}
8282
| ( ( ["FB"; "string"]
8383
| ["string"]
@@ -89,17 +89,17 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
8989
{dependencies = []; type_ = bigint_t}
9090
| (["Js"; "Date"; "t"] | ["Date"; "t"]), [] ->
9191
{dependencies = []; type_ = date_t}
92-
| ["Map"; "t"], [paramTranslation1; paramTranslation2] ->
92+
| ["Map"; "t"], [param_translation1; param_translation2] ->
9393
{
9494
dependencies =
95-
paramTranslation1.dependencies @ paramTranslation2.dependencies;
96-
type_ = map_t (paramTranslation1.type_, paramTranslation2.type_);
95+
param_translation1.dependencies @ param_translation2.dependencies;
96+
type_ = map_t (param_translation1.type_, param_translation2.type_);
9797
}
98-
| ["WeakMap"; "t"], [paramTranslation1; paramTranslation2] ->
98+
| ["WeakMap"; "t"], [param_translation1; param_translation2] ->
9999
{
100100
dependencies =
101-
paramTranslation1.dependencies @ paramTranslation2.dependencies;
102-
type_ = weakmap_t (paramTranslation1.type_, paramTranslation2.type_);
101+
param_translation1.dependencies @ param_translation2.dependencies;
102+
type_ = weakmap_t (param_translation1.type_, param_translation2.type_);
103103
}
104104
| ["Set"; "t"], [param_translation] ->
105105
{
@@ -136,20 +136,20 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
136136
] );
137137
}
138138
| ( (["Pervasives"; "result"] | ["Belt"; "Result"; "t"] | ["result"]),
139-
[paramTranslation1; paramTranslation2] ) ->
139+
[param_translation1; param_translation2] ) ->
140140
let case name type_ = {case = {label_j_s = StringLabel name}; t = type_} in
141141
let variant =
142142
create_variant ~inherits:[] ~no_payloads:[]
143143
~payloads:
144144
[
145-
case "Ok" paramTranslation1.type_;
146-
case "Error" paramTranslation2.type_;
145+
case "Ok" param_translation1.type_;
146+
case "Error" param_translation2.type_;
147147
]
148148
~polymorphic:false ~tag:None ~unboxed:false
149149
in
150150
{
151151
dependencies =
152-
paramTranslation1.dependencies @ paramTranslation2.dependencies;
152+
param_translation1.dependencies @ param_translation2.dependencies;
153153
type_ = variant;
154154
}
155155
| ( (["React"; "callback"] | ["ReactV3"; "React"; "callback"]),
@@ -278,26 +278,26 @@ let rec translate_arrow_type ~config ~type_vars_gen ~type_env ~rev_arg_deps
278278
| Tlink t ->
279279
translate_arrow_type ~config ~type_vars_gen ~type_env ~rev_arg_deps
280280
~rev_args t
281-
| Tarrow (Nolabel, typeExpr1, typeExpr2, _) ->
281+
| Tarrow (Nolabel, type_expr1, type_expr2, _) ->
282282
let {dependencies; type_} =
283-
typeExpr1 |> fun __x ->
283+
type_expr1 |> fun __x ->
284284
translateTypeExprFromTypes_ ~config ~type_vars_gen ~type_env __x
285285
in
286286
let next_rev_deps = List.rev_append dependencies rev_arg_deps in
287-
typeExpr2
287+
type_expr2
288288
|> translate_arrow_type ~config ~type_vars_gen ~type_env
289289
~rev_arg_deps:next_rev_deps
290290
~rev_args:((Nolabel, type_) :: rev_args)
291-
| Tarrow (((Labelled lbl | Optional lbl) as label), typeExpr1, typeExpr2, _)
291+
| Tarrow (((Labelled lbl | Optional lbl) as label), type_expr1, type_expr2, _)
292292
-> (
293-
match typeExpr1 |> remove_option ~label with
293+
match type_expr1 |> remove_option ~label with
294294
| None ->
295295
let {dependencies; type_ = type1} =
296-
typeExpr1
296+
type_expr1
297297
|> translateTypeExprFromTypes_ ~config ~type_vars_gen ~type_env
298298
in
299299
let next_rev_deps = List.rev_append dependencies rev_arg_deps in
300-
typeExpr2
300+
type_expr2
301301
|> translate_arrow_type ~config ~type_vars_gen ~type_env
302302
~rev_arg_deps:next_rev_deps
303303
~rev_args:((Label lbl, type1) :: rev_args)
@@ -306,7 +306,7 @@ let rec translate_arrow_type ~config ~type_vars_gen ~type_env ~rev_arg_deps
306306
t1 |> translateTypeExprFromTypes_ ~config ~type_vars_gen ~type_env
307307
in
308308
let next_rev_deps = List.rev_append dependencies rev_arg_deps in
309-
typeExpr2
309+
type_expr2
310310
|> translate_arrow_type ~config ~type_vars_gen ~type_env
311311
~rev_arg_deps:next_rev_deps
312312
~rev_args:((OptLabel lbl, type1) :: rev_args))
@@ -453,11 +453,11 @@ and translateTypeExprFromTypes_ ~config ~type_vars_gen ~type_env
453453
|> List.map (fun (_, translation) -> translation.dependencies)
454454
|> List.flatten
455455
in
456-
let typeEnv1 = type_env |> TypeEnv.add_type_equations ~type_equations in
456+
let type_env1 = type_env |> TypeEnv.add_type_equations ~type_equations in
457457
let dependencies_from_record_type, type_ =
458458
signature.sig_type
459459
|> signature_to_module_runtime_representation ~config ~type_vars_gen
460-
~type_env:typeEnv1
460+
~type_env:type_env1
461461
in
462462
{
463463
dependencies =
@@ -496,19 +496,19 @@ and signature_to_module_runtime_representation ~config ~type_vars_gen ~type_env
496496
in
497497
(dependencies, [field])
498498
| Types.Sig_module (id, module_declaration, _recStatus) ->
499-
let typeEnv1 =
499+
let type_env1 =
500500
match
501501
type_env |> TypeEnv.get_module ~name:(id |> Ident.name)
502502
with
503-
| Some typeEnv1 -> typeEnv1
503+
| Some type_env1 -> type_env1
504504
| None -> type_env
505505
in
506506
let dependencies, type_ =
507507
match module_declaration.md_type with
508508
| Mty_signature signature ->
509509
signature
510510
|> signature_to_module_runtime_representation ~config
511-
~type_vars_gen ~type_env:typeEnv1
511+
~type_vars_gen ~type_env:type_env1
512512
| Mty_ident _ | Mty_functor _ | Mty_alias _ -> ([], unknown)
513513
in
514514
let field =

jscomp/gentype/TypeEnv.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ let new_type ~name type_env =
5151

5252
let get_module ~name type_env =
5353
match type_env.map |> StringMap.find name with
54-
| Module typeEnv1 -> Some typeEnv1
54+
| Module type_env1 -> Some type_env1
5555
| Type _ -> None
5656
| exception Not_found -> None
5757

@@ -82,13 +82,13 @@ let rec add_type_equation ~flattened ~type_ type_env =
8282
}
8383
| module_name :: rest -> (
8484
match type_env |> get_module ~name:module_name with
85-
| Some typeEnv1 ->
85+
| Some type_env1 ->
8686
{
8787
type_env with
8888
map =
8989
type_env.map
9090
|> StringMap.add module_name
91-
(Module (typeEnv1 |> add_type_equation ~flattened:rest ~type_));
91+
(Module (type_env1 |> add_type_equation ~flattened:rest ~type_));
9292
}
9393
| None -> type_env)
9494
| [] -> type_env
@@ -143,7 +143,7 @@ let rec lookup_module_type ~path type_env =
143143
Log_.item "Typenv.lookupModuleType %s moduleName:%s\n"
144144
(type_env |> to_string) module_name;
145145
match type_env.map |> StringMap.find module_name with
146-
| Module typeEnv1 -> typeEnv1 |> lookup_module_type ~path:path1
146+
| Module type_env1 -> type_env1 |> lookup_module_type ~path:path1
147147
| Type _ -> None
148148
| exception Not_found -> (
149149
match type_env.parent with

jscomp/syntax/benchmarks/Benchmark.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module Time : sig
3333

3434
val now : unit -> t
3535

36-
val toUint64 : t -> int64 [@@live]
36+
val to_uint64 : t -> int64 [@@live]
3737

3838
(* let of_uint64_ns ns = ns *)
3939

@@ -55,7 +55,7 @@ end = struct
5555

5656
let zero = 0L
5757

58-
let toUint64 s = s
58+
let to_uint64 s = s
5959

6060
let nanosecond = 1L
6161
let microsecond = Int64.mul 1000L nanosecond

0 commit comments

Comments
 (0)