@@ -235680,18 +235680,11 @@ type t = string
235680
235680
235681
235681
let curry = "Curry"
235682
235682
let rescriptPervasives = "RescriptPervasives"
235683
- let dotRegex = "." |> Str.quote |> Str.regexp
235684
- let lbracketRegex = "[" |> Str.quote |> Str.regexp
235685
- let rbracketRegex = "]" |> Str.quote |> Str.regexp
235686
235683
235687
235684
let sanitizeId s =
235688
235685
let s =
235689
235686
if String.contains s '.' || String.contains s '[' || String.contains s ']'
235690
- then
235691
- s
235692
- |> Str.global_replace dotRegex "_"
235693
- |> Str.global_replace lbracketRegex "_"
235694
- |> Str.global_replace rbracketRegex "_"
235687
+ then s |> String.map (function '.' | '[' | ']' -> '_' | c -> c)
235695
235688
else s
235696
235689
in
235697
235690
if s <> "" && s.[0] >= 'A' && s.[0] <= 'z' then s else "_" ^ s
@@ -235784,7 +235777,9 @@ let getShims map =
235784
235777
|> Array.iter (fun x ->
235785
235778
match x with
235786
235779
| Ext_json_types.Str { str } ->
235787
- let fromTo = Str.split (Str.regexp "=") str |> Array.of_list in
235780
+ let fromTo =
235781
+ str |> String.split_on_char '=' |> Array.of_list
235782
+ in
235788
235783
assert (Array.length fromTo == 2);
235789
235784
shims := (fromTo.(0), fromTo.(1)) :: !shims
235790
235785
| _ -> ())
@@ -236020,8 +236015,12 @@ type labelJS =
236020
236015
type case = { label : string; labelJS : labelJS }
236021
236016
236022
236017
let isJSSafePropertyName name =
236023
- let jsSafeRegex = {|^[A-z][A-z0-9]*$|} |> Str.regexp in
236024
- Str.string_match jsSafeRegex name 0
236018
+ name = ""
236019
+ || (match name.[0] with 'A' .. 'z' -> true | _ -> false)
236020
+ && name
236021
+ |> String.for_all (function
236022
+ | 'A' .. 'z' | '0' .. '9' -> true
236023
+ | _ -> false)
236025
236024
236026
236025
let labelJSToString ?(alwaysQuotes = false) case =
236027
236026
let addQuotes x =
@@ -236198,7 +236197,7 @@ let variantTable hash ~toJS =
236198
236197
let ident ?(builtin = true) ?(typeArgs = []) name =
236199
236198
Ident { builtin; name; typeArgs }
236200
236199
236201
- let sanitizeTypeName name = name |> Str.global_replace (Str.regexp "'") "_"
236200
+ let sanitizeTypeName name = name |> String.map (function '\'' -> '_' | c -> c)
236202
236201
let unknown = ident "unknown"
236203
236202
let booleanT = ident "boolean"
236204
236203
let dateT = ident "Date"
@@ -236224,7 +236223,7 @@ module NodeFilename = struct
236224
236223
236225
236224
let normalize path : t =
236226
236225
match Sys.os_type with
236227
- | "Win32" -> path |> Str.split (Str.regexp "\\") |> String.concat dirSep
236226
+ | "Win32" -> path |> String.split_on_char '\\' |> String.concat dirSep
236228
236227
| _ -> path
236229
236228
236230
236229
let toString path = path
@@ -236528,7 +236527,8 @@ and structureCheckAnnotation ~checkAnnotation (structure : Typedtree.structure)
236528
236527
structure.str_items
236529
236528
|> List.exists (structureItemCheckAnnotation ~checkAnnotation)
236530
236529
236531
- let sanitizeVariableName name = name |> Str.global_replace (Str.regexp "-") "_"
236530
+ let sanitizeVariableName name =
236531
+ name |> String.map (function '-' -> '_' | c -> c)
236532
236532
236533
236533
let importFromString importString : import =
236534
236534
let name =
@@ -240407,7 +240407,7 @@ let rec emitCodeItem ~config ~emitters ~moduleItemsEmitter ~env ~fileName
240407
240407
match valueName = asPath with
240408
240408
| true -> (valueName, "")
240409
240409
| false -> (
240410
- match asPath |> Str.split (Str.regexp "\\.") with
240410
+ match asPath |> String.split_on_char '.' with
240411
240411
| x :: y -> (x, "" :: y |> String.concat ".")
240412
240412
| _ -> (asPath, ""))
240413
240413
in
0 commit comments