Skip to content

Commit f7f41eb

Browse files
committed
chore: camelCase to snake_case
1 parent 8e4d23f commit f7f41eb

File tree

164 files changed

+19297
-19297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+19297
-19297
lines changed

jscomp/bsc/rescript_compiler_main.ml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ let process_file sourcefile ?(kind ) ppf =
7272
let sourcefile = set_abs_input_name sourcefile in
7373
setup_compiler_printer `rescript;
7474
Js_implementation.implementation
75-
~parser:(Res_driver.parse_implementation ~ignoreParseErrors:!Clflags.ignore_parse_errors)
75+
~parser:(Res_driver.parse_implementation ~ignore_parse_errors:!Clflags.ignore_parse_errors)
7676
ppf sourcefile
7777
| Resi ->
7878
let sourcefile = set_abs_input_name sourcefile in
7979
setup_compiler_printer `rescript;
8080
Js_implementation.interface
81-
~parser:(Res_driver.parse_interface ~ignoreParseErrors:!Clflags.ignore_parse_errors)
81+
~parser:(Res_driver.parse_interface ~ignore_parse_errors:!Clflags.ignore_parse_errors)
8282
ppf sourcefile
8383
| Intf_ast
8484
->
@@ -113,32 +113,32 @@ let reprint_source_file sourcefile =
113113
let sourcefile = set_abs_input_name sourcefile in
114114
let res = match kind with
115115
| Res ->
116-
let parseResult =
117-
Res_driver.parsingEngine.parseImplementation ~forPrinter:true ~filename:sourcefile
116+
let parse_result =
117+
Res_driver.parsing_engine.parse_implementation ~for_printer:true ~filename:sourcefile
118118
in
119-
if parseResult.invalid then (
120-
Res_diagnostics.printReport parseResult.diagnostics parseResult.source;
119+
if parse_result.invalid then (
120+
Res_diagnostics.print_report parse_result.diagnostics parse_result.source;
121121
exit 1
122122
);
123123
Res_compmisc.init_path ();
124-
parseResult.parsetree
124+
parse_result.parsetree
125125
|> Cmd_ppx_apply.apply_rewriters ~restore:false ~tool_name:Js_config.tool_name Ml
126126
|> Ppx_entry.rewrite_implementation
127-
|> Res_printer.printImplementation ~width:100 ~comments:parseResult.comments
127+
|> Res_printer.print_implementation ~width:100 ~comments:parse_result.comments
128128
|> print_endline
129129
| Resi ->
130-
let parseResult =
131-
Res_driver.parsingEngine.parseInterface ~forPrinter:true ~filename:sourcefile
130+
let parse_result =
131+
Res_driver.parsing_engine.parse_interface ~for_printer:true ~filename:sourcefile
132132
in
133-
if parseResult.invalid then (
134-
Res_diagnostics.printReport parseResult.diagnostics parseResult.source;
133+
if parse_result.invalid then (
134+
Res_diagnostics.print_report parse_result.diagnostics parse_result.source;
135135
exit 1
136136
);
137137
Res_compmisc.init_path ();
138-
parseResult.parsetree
138+
parse_result.parsetree
139139
|> Cmd_ppx_apply.apply_rewriters ~restore:false ~tool_name:Js_config.tool_name Mli
140140
|> Ppx_entry.rewrite_signature
141-
|> Res_printer.printInterface ~width:100 ~comments:parseResult.comments
141+
|> Res_printer.print_interface ~width:100 ~comments:parse_result.comments
142142
|> print_endline
143143
| _
144144
->
@@ -198,7 +198,7 @@ let format_file input =
198198
| Ml | Mli -> `ml
199199
| Res | Resi -> `res
200200
| _ -> Bsc_args.bad_arg ("don't know what to do with " ^ input) in
201-
let formatted = Res_multi_printer.print ~ignoreParseErrors:!Clflags.ignore_parse_errors syntax ~input in
201+
let formatted = Res_multi_printer.print ~ignore_parse_errors:!Clflags.ignore_parse_errors syntax ~input in
202202
match !Clflags.output_name with
203203
| None ->
204204
output_string stdout formatted
@@ -293,11 +293,11 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
293293
"*internal* Set jsx version";
294294

295295
"-bs-jsx-module", string_call (fun i ->
296-
let isGeneric = match i |> String.lowercase_ascii with
296+
let is_generic = match i |> String.lowercase_ascii with
297297
| "react" -> false
298298
| _ -> true in
299299
Js_config.jsx_module := Js_config.jsx_module_of_string i;
300-
if isGeneric then (
300+
if is_generic then (
301301
Js_config.jsx_mode := Automatic;
302302
Js_config.jsx_version := Some Jsx_v4
303303
)),

jscomp/common/js_config.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
(** Browser is not set via command line only for internal use *)
2626

2727
type jsx_version = Jsx_v3 | Jsx_v4
28-
type jsx_module = React | Generic of {moduleName: string}
28+
type jsx_module = React | Generic of {module_name: string}
2929
type jsx_mode = Classic | Automatic
3030

3131
let no_version_header = ref false
@@ -64,7 +64,7 @@ let int_of_jsx_version = function
6464

6565
let string_of_jsx_module = function
6666
| React -> "react"
67-
| Generic {moduleName} -> moduleName
67+
| Generic {module_name} -> module_name
6868

6969
let string_of_jsx_mode = function
7070
| Classic -> "classic"
@@ -77,7 +77,7 @@ let jsx_version_of_int = function
7777

7878
let jsx_module_of_string = function
7979
| "react" -> React
80-
| moduleName -> Generic {moduleName}
80+
| module_name -> Generic {module_name}
8181

8282
let jsx_mode_of_string = function
8383
| "classic" -> Classic

jscomp/common/js_config.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

2525
type jsx_version = Jsx_v3 | Jsx_v4
26-
type jsx_module = React | Generic of {moduleName: string}
26+
type jsx_module = React | Generic of {module_name: string}
2727
type jsx_mode = Classic | Automatic
2828

2929
(* val get_packages_info :

jscomp/common/pattern_printer.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ let mkpat desc = Ast_helper.Pat.mk desc
77
let untype typed =
88
let rec loop pat =
99
match pat.pat_desc with
10-
| Tpat_or (p1, { pat_desc = Tpat_or (p2, p3, rI) }, rO) ->
10+
| Tpat_or (p1, { pat_desc = Tpat_or (p2, p3, r_i) }, r_o) ->
1111
(* Turn A | (B | C) into (A | B) | C for pretty printing without parens *)
12-
let newInner = { pat with pat_desc = Tpat_or (p1, p2, rI) } in
13-
let newOuter = { pat with pat_desc = Tpat_or (newInner, p3, rO) } in
14-
loop newOuter
12+
let new_inner = { pat with pat_desc = Tpat_or (p1, p2, r_i) } in
13+
let new_outer = { pat with pat_desc = Tpat_or (new_inner, p3, r_o) } in
14+
loop new_outer
1515
| Tpat_or (pa, pb, _) -> mkpat (Ppat_or (loop pa, loop pb))
1616
| Tpat_any | Tpat_var _ -> mkpat Ppat_any
1717
| Tpat_constant c -> mkpat (Ppat_constant (Untypeast.constant c))
@@ -44,5 +44,5 @@ let untype typed =
4444

4545
let print_pattern typed =
4646
let pat = untype typed in
47-
let doc = Res_printer.printPattern pat Res_comments_table.empty in
48-
Res_doc.toString ~width:80 doc
47+
let doc = Res_printer.print_pattern pat Res_comments_table.empty in
48+
Res_doc.to_string ~width:80 doc

jscomp/core/bs_conditional_initial.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ let setup_env () =
4949

5050
Rescript_cpp.replace_directive_bool "BS" true;
5151
Rescript_cpp.replace_directive_bool "JS" true;
52-
Printtyp.print_res_poly_identifier := Res_printer.polyVarIdentToString;
52+
Printtyp.print_res_poly_identifier := Res_printer.poly_var_ident_to_string;
5353
Rescript_cpp.replace_directive_string "BS_VERSION" Bs_version.version
5454
(*; Switch.cut := 100*) (* tweakable but not very useful *)
5555

jscomp/core/j.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ and expression_desc =
160160
*)
161161
| Number of number
162162
| Object of property_map
163-
| Undefined of {isUnit: bool}
163+
| Undefined of {is_unit: bool}
164164
| Null
165165
| Await of expression
166166

jscomp/core/js_cmj_format.ml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -104,57 +104,57 @@ let to_file name ~check_exists (v : t) =
104104
output_string oc s;
105105
close_out oc)
106106

107-
let keyComp (a : string) b = Map_string.compare_key a b.name
107+
let key_comp (a : string) b = Map_string.compare_key a b.name
108108

109109
let not_found key =
110110
{ name = key; arity = single_na; persistent_closed_lambda = None }
111111

112-
let get_result midVal =
113-
match midVal.persistent_closed_lambda with
112+
let get_result mid_val =
113+
match mid_val.persistent_closed_lambda with
114114
| Some
115115
(Lconst
116116
(Const_js_null | Const_js_undefined _ | Const_js_true | Const_js_false))
117117
| None ->
118-
midVal
118+
mid_val
119119
| Some _ ->
120-
if !Js_config.cross_module_inline then midVal
121-
else { midVal with persistent_closed_lambda = None }
120+
if !Js_config.cross_module_inline then mid_val
121+
else { mid_val with persistent_closed_lambda = None }
122122

123-
let rec binarySearchAux arr lo hi (key : string) =
123+
let rec binary_search_aux arr lo hi (key : string) =
124124
let mid = (lo + hi) / 2 in
125-
let midVal = Array.unsafe_get arr mid in
126-
let c = keyComp key midVal in
127-
if c = 0 then get_result midVal
125+
let mid_val = Array.unsafe_get arr mid in
126+
let c = key_comp key mid_val in
127+
if c = 0 then get_result mid_val
128128
else if c < 0 then
129129
(* a[lo] =< key < a[mid] <= a[hi] *)
130130
if hi = mid then
131-
let loVal = Array.unsafe_get arr lo in
132-
if loVal.name = key then get_result loVal else not_found key
133-
else binarySearchAux arr lo mid key
131+
let lo_val = Array.unsafe_get arr lo in
132+
if lo_val.name = key then get_result lo_val else not_found key
133+
else binary_search_aux arr lo mid key
134134
else if (* a[lo] =< a[mid] < key <= a[hi] *)
135135
lo = mid then
136-
let hiVal = Array.unsafe_get arr hi in
137-
if hiVal.name = key then get_result hiVal else not_found key
138-
else binarySearchAux arr mid hi key
136+
let hi_val = Array.unsafe_get arr hi in
137+
if hi_val.name = key then get_result hi_val else not_found key
138+
else binary_search_aux arr mid hi key
139139

140-
let binarySearch (sorted : keyed_cmj_values) (key : string) : keyed_cmj_value =
140+
let binary_search (sorted : keyed_cmj_values) (key : string) : keyed_cmj_value =
141141
let len = Array.length sorted in
142142
if len = 0 then not_found key
143143
else
144144
let lo = Array.unsafe_get sorted 0 in
145-
let c = keyComp key lo in
145+
let c = key_comp key lo in
146146
if c < 0 then not_found key
147147
else
148148
let hi = Array.unsafe_get sorted (len - 1) in
149-
let c2 = keyComp key hi in
150-
if c2 > 0 then not_found key else binarySearchAux sorted 0 (len - 1) key
149+
let c2 = key_comp key hi in
150+
if c2 > 0 then not_found key else binary_search_aux sorted 0 (len - 1) key
151151

152152
(* FIXME: better error message when ocamldep
153153
get self-cycle
154154
*)
155155
let query_by_name (cmj_table : t) name : keyed_cmj_value =
156156
let values = cmj_table.values in
157-
binarySearch values name
157+
binary_search values name
158158

159159
type path = string
160160

jscomp/core/js_dump.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ and expression_desc cxt ~(level : int) f x : cxt =
573573
params body env
574574
| _ ->
575575
let el = match el with
576-
| [e] when e.expression_desc = Undefined {isUnit = true} ->
576+
| [e] when e.expression_desc = Undefined {is_unit = true} ->
577577
(* omit passing undefined when the call is f() *)
578578
[]
579579
| _ ->
@@ -597,8 +597,8 @@ and expression_desc cxt ~(level : int) f x : cxt =
597597
P.string f L.null;
598598
comma_sp f;
599599
expression ~level:1 cxt f el))
600-
| Tagged_template (callExpr, stringArgs, valueArgs) ->
601-
let cxt = expression cxt ~level f callExpr in
600+
| Tagged_template (call_expr, string_args, value_args) ->
601+
let cxt = expression cxt ~level f call_expr in
602602
P.string f "`";
603603
let rec aux cxt xs ys = match xs, ys with
604604
| [], [] -> ()
@@ -612,14 +612,14 @@ and expression_desc cxt ~(level : int) f x : cxt =
612612
aux cxt x_rest y_rest
613613
| _ -> assert false
614614
in
615-
aux cxt stringArgs valueArgs;
615+
aux cxt string_args value_args;
616616
P.string f "`";
617617
cxt
618618
| String_index (a, b) ->
619619
P.group f 1 (fun _ ->
620620
let cxt = expression ~level:15 cxt f a in
621621
P.string f L.dot;
622-
P.string f L.codePointAt;
622+
P.string f L.code_point_at;
623623
(* FIXME: use code_point_at *)
624624
P.paren_group f 1 (fun _ -> expression ~level:0 cxt f b))
625625
| Str { delim; txt } ->

jscomp/core/js_dump_import_export.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module L = Js_dump_lit
2727

2828
let default_export = "default"
2929

30-
let esModule = ("__esModule", "true")
30+
let es_module = ("__esModule", "true")
3131
(* Exports printer *)
3232

3333
let rev_iter_inter lst f inter =
@@ -50,7 +50,7 @@ let exports cxt f (idents : Ident.t list) =
5050
( cxt,
5151
if id_name = default_export then
5252
(* TODO check how it will affect AMDJS*)
53-
esModule :: (default_export, str) :: acc
53+
es_module :: (default_export, str) :: acc
5454
else (s, str) :: acc ))
5555
in
5656
P.at_least_two_lines f;
@@ -120,23 +120,23 @@ let requires require_lit cxt f (modules : (Ident.t * string * bool) list) =
120120
P.newline f);
121121
outer_cxt
122122

123-
let dumpImportAttributes f (importAttributes : External_ffi_types.import_attributes option) =
124-
match importAttributes with
123+
let dump_import_attributes f (import_attributes : External_ffi_types.import_attributes option) =
124+
match import_attributes with
125125
| None -> ()
126-
| Some importAttributes ->
126+
| Some import_attributes ->
127127
P.space f;
128128
P.string f "with";
129129
P.space f;
130-
let total = Hashtbl.length importAttributes in
130+
let total = Hashtbl.length import_attributes in
131131
let idx = ref 1 in
132132
P.brace_group f 0 (
133133
fun _ ->
134-
importAttributes |> Hashtbl.iter(fun key value ->
134+
import_attributes |> Hashtbl.iter(fun key value ->
135135
Js_dump_string.pp_string f key;
136136
P.string f L.colon_space;
137137
Js_dump_string.pp_string f value;
138-
let shouldAddComma = !idx < total in
139-
if shouldAddComma then (
138+
let should_add_comma = !idx < total in
139+
if should_add_comma then (
140140
P.string f L.comma;
141141
P.space f
142142
);
@@ -162,7 +162,7 @@ let imports cxt f (modules : (Ident.t * string * bool * External_ffi_types.impor
162162
P.string f L.from;
163163
P.space f;
164164
Js_dump_string.pp_string f file;
165-
dumpImportAttributes f import_attributes)
165+
dump_import_attributes f import_attributes)
166166
else (
167167
P.string f L.star;
168168
P.space f;
@@ -174,7 +174,7 @@ let imports cxt f (modules : (Ident.t * string * bool * External_ffi_types.impor
174174
P.string f L.from;
175175
P.space f;
176176
Js_dump_string.pp_string f file;
177-
dumpImportAttributes f import_attributes);
177+
dump_import_attributes f import_attributes);
178178
P.string f L.semi;
179179
P.newline f);
180180
outer_cxt

jscomp/core/js_dump_lit.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let default = "default"
6666

6767
let length = "length"
6868

69-
let codePointAt = "codePointAt"
69+
let code_point_at = "codePointAt"
7070

7171
let new_ = "new"
7272

@@ -136,7 +136,7 @@ let undefined = "undefined"
136136

137137
let string_cap = "String"
138138

139-
let fromCharcode = "fromCharCode"
139+
let from_charcode = "fromCharCode"
140140

141141
let eq = "="
142142

0 commit comments

Comments
 (0)