Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit bd15389

Browse files
committedApr 15, 2021
Convert some Str.split and remove Utils.split_on_char
1 parent fc94192 commit bd15389

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed
 

‎src/FindFiles.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ let isSourceFile name =
4646
|| Filename.check_suffix name ".mli"
4747

4848
let compiledNameSpace name =
49-
Str.split (Str.regexp_string "-") name
49+
String.split_on_char '-' name
5050
|> List.map String.capitalize_ascii
5151
|> String.concat ""
5252
(* Remove underscores??? Whyyy bucklescript, whyyyy *)
53-
|> Str.split (Str.regexp_string "_")
53+
|> String.split_on_char '_'
5454
|> String.concat ""
5555

5656
let compiledBaseName ~namespace name =

‎src/Packages.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ let newBsPackage rootPath =
7979
match item |> Json.string with
8080
| None -> opens
8181
| Some s -> (
82-
let parts = Utils.split_on_char ' ' s in
82+
let parts = String.split_on_char ' ' s in
8383
match parts with
8484
| "-open" :: name :: _ -> name :: opens
8585
| _ -> opens))

‎src/Utils.ml

-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
(*
2-
steal from OCaml stdlib
3-
https://github.com/ocaml/ocaml/blob/7c9c210884e1b46f21af5bb4dfab995bb3336cf7/stdlib/string.ml#L205-L214
4-
*)
5-
let split_on_char sep s =
6-
let open String in
7-
let r = ref [] in
8-
let j = ref (length s) in
9-
for i = length s - 1 downto 0 do
10-
if unsafe_get s i = sep then (
11-
r := sub s (i + 1) (!j - i - 1) :: !r;
12-
j := i)
13-
done;
14-
sub s 0 !j :: !r
15-
161
let topLoc fname =
172
{
183
Location.loc_start =

0 commit comments

Comments
 (0)
This repository has been archived.