Skip to content

Commit c90ca60

Browse files
committed
convert ext/
1 parent 23d9777 commit c90ca60

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

jscomp/ext/ext_cmp.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ type 'a compare = 'a -> 'a -> int
22

33
type ('a, 'id) cmp = 'a compare
44

5-
external getCmp : ('a, 'id) cmp -> 'a compare = "%identity"
5+
external get_cmp : ('a, 'id) cmp -> 'a compare = "%identity"
66

77
module type S = sig
88
type id

jscomp/ext/ext_cmp.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ type 'a compare = 'a -> 'a -> int
22

33
type ('a, 'id) cmp
44

5-
external getCmp : ('a, 'id) cmp -> 'a compare = "%identity"
5+
external get_cmp : ('a, 'id) cmp -> 'a compare = "%identity"
66
(** only used for data structures, not exported for client usage *)
77

88
module type S = sig

jscomp/ext/ext_string_array.ml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@
2525
(* Invariant: the same as encoding Map_string.compare_key *)
2626
let cmp = Ext_string.compare
2727

28-
let rec binarySearchAux (arr : string array) (lo : int) (hi : int)
28+
let rec binary_search_aux (arr : string array) (lo : int) (hi : int)
2929
(key : string) : _ option =
3030
let mid = (lo + hi) / 2 in
31-
let midVal = Array.unsafe_get arr mid in
32-
let c = cmp key midVal in
31+
let mid_val = Array.unsafe_get arr mid in
32+
let c = cmp key mid_val in
3333
if c = 0 then Some mid
3434
else if c < 0 then
3535
(* a[lo] =< key < a[mid] <= a[hi] *)
3636
if hi = mid then
37-
let loVal = Array.unsafe_get arr lo in
38-
if loVal = key then Some lo else None
39-
else binarySearchAux arr lo mid key
37+
let lo_val = Array.unsafe_get arr lo in
38+
if lo_val = key then Some lo else None
39+
else binary_search_aux arr lo mid key
4040
else if (* a[lo] =< a[mid] < key <= a[hi] *)
4141
lo = mid then
42-
let hiVal = Array.unsafe_get arr hi in
43-
if hiVal = key then Some hi else None
44-
else binarySearchAux arr mid hi key
42+
let hi_val = Array.unsafe_get arr hi in
43+
if hi_val = key then Some hi else None
44+
else binary_search_aux arr mid hi key
4545

4646
let find_sorted sorted key : int option =
4747
let len = Array.length sorted in
@@ -53,25 +53,25 @@ let find_sorted sorted key : int option =
5353
else
5454
let hi = Array.unsafe_get sorted (len - 1) in
5555
let c2 = cmp key hi in
56-
if c2 > 0 then None else binarySearchAux sorted 0 (len - 1) key
56+
if c2 > 0 then None else binary_search_aux sorted 0 (len - 1) key
5757

58-
let rec binarySearchAssoc (arr : (string * _) array) (lo : int) (hi : int)
58+
let rec binary_search_assoc (arr : (string * _) array) (lo : int) (hi : int)
5959
(key : string) : _ option =
6060
let mid = (lo + hi) / 2 in
61-
let midVal = Array.unsafe_get arr mid in
62-
let c = cmp key (fst midVal) in
63-
if c = 0 then Some (snd midVal)
61+
let mid_val = Array.unsafe_get arr mid in
62+
let c = cmp key (fst mid_val) in
63+
if c = 0 then Some (snd mid_val)
6464
else if c < 0 then
6565
(* a[lo] =< key < a[mid] <= a[hi] *)
6666
if hi = mid then
67-
let loVal = Array.unsafe_get arr lo in
68-
if fst loVal = key then Some (snd loVal) else None
69-
else binarySearchAssoc arr lo mid key
67+
let lo_val = Array.unsafe_get arr lo in
68+
if fst lo_val = key then Some (snd lo_val) else None
69+
else binary_search_assoc arr lo mid key
7070
else if (* a[lo] =< a[mid] < key <= a[hi] *)
7171
lo = mid then
72-
let hiVal = Array.unsafe_get arr hi in
73-
if fst hiVal = key then Some (snd hiVal) else None
74-
else binarySearchAssoc arr mid hi key
72+
let hi_val = Array.unsafe_get arr hi in
73+
if fst hi_val = key then Some (snd hi_val) else None
74+
else binary_search_assoc arr mid hi key
7575

7676
let find_sorted_assoc (type a) (sorted : (string * a) array) (key : string) :
7777
a option =
@@ -84,4 +84,4 @@ let find_sorted_assoc (type a) (sorted : (string * a) array) (key : string) :
8484
else
8585
let hi = Array.unsafe_get sorted (len - 1) in
8686
let c2 = cmp key (fst hi) in
87-
if c2 > 0 then None else binarySearchAssoc sorted 0 (len - 1) key
87+
if c2 > 0 then None else binary_search_assoc sorted 0 (len - 1) key

jscomp/ext/js_reserved_map.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -790,21 +790,21 @@ let sorted_keywords = [|
790790

791791
type element = string
792792

793-
let rec binarySearchAux (arr : element array) (lo : int) (hi : int) key : bool =
793+
let rec binary_search_aux (arr : element array) (lo : int) (hi : int) key : bool =
794794
let mid = (lo + hi)/2 in
795-
let midVal = Array.unsafe_get arr mid in
795+
let mid_val = Array.unsafe_get arr mid in
796796
(* let c = cmp key midVal [@bs] in *)
797-
if key = midVal then true
798-
else if key < midVal then (* a[lo] =< key < a[mid] <= a[hi] *)
797+
if key = mid_val then true
798+
else if key < mid_val then (* a[lo] =< key < a[mid] <= a[hi] *)
799799
if hi = mid then
800800
(Array.unsafe_get arr lo) = key
801-
else binarySearchAux arr lo mid key
801+
else binary_search_aux arr lo mid key
802802
else (* a[lo] =< a[mid] < key <= a[hi] *)
803803
if lo = mid then
804804
(Array.unsafe_get arr hi) = key
805-
else binarySearchAux arr mid hi key
805+
else binary_search_aux arr mid hi key
806806

807-
let binarySearch (sorted : element array) (key : element) : bool =
807+
let binary_search (sorted : element array) (key : element) : bool =
808808
let len = Array.length sorted in
809809
if len = 0 then false
810810
else
@@ -815,6 +815,6 @@ let binarySearch (sorted : element array) (key : element) : bool =
815815
let hi = Array.unsafe_get sorted (len - 1) in
816816
(* let c2 = cmp key hi [@bs]in *)
817817
if key > hi then false
818-
else binarySearchAux sorted 0 (len - 1) key
818+
else binary_search_aux sorted 0 (len - 1) key
819819

820-
let is_reserved s = binarySearch sorted_keywords s
820+
let is_reserved s = binary_search sorted_keywords s

jscomp/ext/warnings.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type loc = {
2626
loc_ghost : bool;
2727
}
2828

29-
type topLevelUnitHelp = FunctionCall | Other
29+
type top_level_unit_help = FunctionCall | Other
3030

3131
type t =
3232
| Comment_start (* 1 *)
@@ -85,7 +85,7 @@ type t =
8585
| Bs_unimplemented_primitive of string (* 106 *)
8686
| Bs_integer_literal_overflow (* 107 *)
8787
| Bs_uninterpreted_delimiters of string (* 108 *)
88-
| Bs_toplevel_expression_unit of (string * topLevelUnitHelp) option (* 109 *)
88+
| Bs_toplevel_expression_unit of (string * top_level_unit_help) option (* 109 *)
8989

9090
(* If you remove a warning, leave a hole in the numbering. NEVER change
9191
the numbers of existing warnings.
@@ -499,15 +499,15 @@ let message = function
499499
| _ -> " ")
500500

501501
(match help with
502-
| Some (returnType, _) -> Printf.sprintf "`%s`" returnType
502+
| Some (return_type, _) -> Printf.sprintf "`%s`" return_type
503503
| None -> "something that is not `unit`")
504504

505505
(match help with
506-
| Some (_, helpTyp) ->
507-
let helpText = (match helpTyp with
506+
| Some (_, help_typ) ->
507+
let help_text = (match help_typ with
508508
| FunctionCall -> "yourFunctionCall()"
509509
| Other -> "yourExpression") in
510-
Printf.sprintf "\n\n Possible solutions:\n - Assigning to a value that is then ignored: `let _ = %s`\n - Piping into the built-in ignore function to ignore the result: `%s->ignore`" helpText helpText
510+
Printf.sprintf "\n\n Possible solutions:\n - Assigning to a value that is then ignored: `let _ = %s`\n - Piping into the built-in ignore function to ignore the result: `%s->ignore`" help_text help_text
511511
| _ -> "")
512512

513513
let sub_locs = function

jscomp/ext/warnings.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type loc = {
1919
loc_ghost : bool;
2020
}
2121

22-
type topLevelUnitHelp = FunctionCall | Other
22+
type top_level_unit_help = FunctionCall | Other
2323

2424
type t =
2525
| Comment_start (* 1 *)
@@ -78,7 +78,7 @@ type t =
7878
| Bs_unimplemented_primitive of string (* 106 *)
7979
| Bs_integer_literal_overflow (* 107 *)
8080
| Bs_uninterpreted_delimiters of string (* 108 *)
81-
| Bs_toplevel_expression_unit of (string * topLevelUnitHelp) option (* 109 *)
81+
| Bs_toplevel_expression_unit of (string * top_level_unit_help) option (* 109 *)
8282

8383
val parse_options : bool -> string -> unit
8484

0 commit comments

Comments
 (0)