Skip to content

Commit 05a168a

Browse files
committed
Apply changes accordingly
Check the output of ocamlobjinfo bsb_helper.cmx make sure unused dependency not pulled in
1 parent 12080f2 commit 05a168a

Some content is hidden

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

46 files changed

+27387
-28255
lines changed

jscomp/bsb/bsb_ninja_file_groups.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ let handle_generators oc
3737
Ext_list.iter group.generators (fun {output; input; command} ->
3838
(*TODO: add a loc for better error message *)
3939
match String_map.find_opt custom_rules command with
40-
| None -> Ext_pervasives.failwithf ~loc:__LOC__ "custom rule %s used but not defined" command
40+
| None -> Ext_fmt.failwithf ~loc:__LOC__ "custom rule %s used but not defined" command
4141
| Some rule ->
4242
Bsb_ninja_targets.output_build oc
4343
~outputs:(Ext_list.map output map_to_source_dir)

jscomp/bsb_helper/bsb_db_decode.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ let read_build_cache ~dir : t =
9393
Ext_io.load_file (Filename.concat dir bsbuild_cache) in
9494
decode_internal all_content (ref (Ext_digest.length + 1)), all_content
9595

96-
let cmp (a : string) b = String_map.compare_key a b
96+
(* Invariant: the same as encoding String_map.compare_key *)
97+
let cmp = Ext_string.compare
98+
9799

98100
let rec binarySearchAux (arr : string array) (lo : int) (hi : int) (key : string) : _ option =
99101
let mid = (lo + hi)/2 in
@@ -129,7 +131,7 @@ let find_opt_aux sorted key : _ option =
129131

130132

131133
type module_info = {
132-
case : Bsb_db.case;
134+
case : bool ; (* which is Bsb_db.case*)
133135
dir_name : string
134136
}
135137

jscomp/bsb_helper/bsb_db_decode.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ val read_build_cache :
4848

4949

5050
type module_info = {
51-
case : Bsb_db.case;
51+
case : bool (* Bsb_db.case*);
5252
dir_name : string
5353
}
5454

jscomp/common/js_config.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@
3030
(* let add_npm_package_path s =
3131
match !packages_info with
3232
| Empty ->
33-
Ext_pervasives.bad_argf "please set package name first using -bs-package-name ";
33+
Ext_arg.bad_argf "please set package name first using -bs-package-name ";
3434
| NonBrowser(name, envs) ->
3535
let env, path =
3636
match Ext_string.split ~keep_empty:false s ':' with
3737
| [ package_name; path] ->
3838
(match Js_packages_info.module_system_of_string package_name with
3939
| Some x -> x
4040
| None ->
41-
Ext_pervasives.bad_argf "invalid module system %s" package_name), path
41+
Ext_arg.bad_argf "invalid module system %s" package_name), path
4242
| [path] ->
4343
NodeJS, path
4444
| _ ->
45-
Ext_pervasives.bad_argf "invalid npm package path: %s" s
45+
Ext_arg.bad_argf "invalid npm package path: %s" s
4646
in
4747
packages_info := NonBrowser (name, ((env,path) :: envs)) *)
4848
(** Browser is not set via command line only for internal use *)

jscomp/core/js_cmj_format.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ let digest_length = 16 (*16 chars *)
8888
let verify_magic_in_beg ic =
8989
let buffer = really_input_string ic cmj_magic_number_length in
9090
if buffer <> cmj_magic_number then
91-
Ext_pervasives.failwithf ~loc:__LOC__
91+
Ext_fmt.failwithf ~loc:__LOC__
9292
"cmj files have incompatible versions, please rebuilt using the new compiler : %s"
9393
__LOC__
9494

@@ -116,7 +116,7 @@ let from_string s : t =
116116
if magic_number = cmj_magic_number then
117117
Marshal.from_string s (digest_length + cmj_magic_number_length)
118118
else
119-
Ext_pervasives.failwithf ~loc:__LOC__
119+
Ext_fmt.failwithf ~loc:__LOC__
120120
"cmj files have incompatible versions, please rebuilt using the new compiler : %s"
121121
__LOC__
122122

jscomp/core/js_exp_make.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,15 @@ let int32_lsl ?comment (e1 : J.expression) (e2 : J.expression) : J.expression =
11281128
expression_desc = Bin (Lsl, e1,e2)
11291129
}
11301130

1131+
let is_pos_pow n =
1132+
let module M = struct exception E end in
1133+
let rec aux c (n : Int32.t) =
1134+
if n <= 0l then -2
1135+
else if n = 1l then c
1136+
else if Int32.logand n 1l = 0l then
1137+
aux (c + 1) (Int32.shift_right n 1 )
1138+
else raise_notrace M.E in
1139+
try aux 0 n with M.E -> -1
11311140

11321141
let int32_mul ?comment
11331142
(e1 : J.expression)
@@ -1144,7 +1153,7 @@ let int32_mul ?comment
11441153
| e , {expression_desc = Number (Int {i = i0} | Uint i0 ); _}
11451154
| {expression_desc = Number (Int {i = i0} | Uint i0 ); _}, e
11461155
->
1147-
let i = Ext_pervasives.is_pos_pow i0 in
1156+
let i = is_pos_pow i0 in
11481157
if i >= 0 then
11491158
int32_lsl e (small_int i)
11501159
else

jscomp/core/js_packages_info.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,23 +228,23 @@ let get_output_dir
228228

229229
let add_npm_package_path (packages_info : t) (s : string) : t =
230230
if is_empty packages_info then
231-
Ext_pervasives.bad_argf "please set package name first using -bs-package-name "
231+
Ext_arg.bad_argf "please set package name first using -bs-package-name "
232232
else
233233
let module_system, path =
234234
match Ext_string.split ~keep_empty:false s ':' with
235235
| [ module_system; path] ->
236236
(match module_system_of_string module_system with
237237
| Some x -> x
238238
| None ->
239-
Ext_pervasives.bad_argf "invalid module system %s" module_system), path
239+
Ext_arg.bad_argf "invalid module system %s" module_system), path
240240
| [path] ->
241241
NodeJS, path
242242
| module_system :: path ->
243243
(match module_system_of_string module_system with
244244
| Some x -> x
245-
| None -> Ext_pervasives.bad_argf "invalid module system %s" module_system), (String.concat ":" path)
245+
| None -> Ext_arg.bad_argf "invalid module system %s" module_system), (String.concat ":" path)
246246
| _ ->
247-
Ext_pervasives.bad_argf "invalid npm package path: %s" s
247+
Ext_arg.bad_argf "invalid npm package path: %s" s
248248
in
249249
{ packages_info with module_systems = {module_system; path}::packages_info.module_systems}
250250

jscomp/core/js_packages_state.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let set_package_name name =
3131
if Js_packages_info.is_empty !packages_info then
3232
packages_info := Js_packages_info.from_name name
3333
else
34-
Ext_pervasives.bad_argf "duplicated flag for -bs-package-name"
34+
Ext_arg.bad_argf "duplicated flag for -bs-package-name"
3535

3636
let set_package_map module_name =
3737
(* set_package_name name ;

jscomp/core/lam_compile_main.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ let compile
213213
if Js_config.is_same_file () then
214214
let f =
215215
Ext_filename.new_extension !Location.input_name ".lambda" in
216-
Ext_pervasives.with_file_as_pp f begin fun fmt ->
216+
Ext_fmt.with_file_as_pp f begin fun fmt ->
217217
Format.pp_print_list ~pp_sep:Format.pp_print_newline
218218
(Lam_group.pp_group env) fmt (coerced_input.groups)
219219
end;

jscomp/core/lam_convert.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ let exception_id_destructed (l : Lam.t) (fv : Ident.t): bool =
6060
| Some a -> hit a
6161
and hit_list_snd : 'a. ('a * _ ) list -> bool = fun x ->
6262
Ext_list.exists_snd x hit
63-
and hit_list xs = List.exists hit xs
63+
and hit_list xs = Ext_list.exists xs hit
6464
and hit (l : Lam.t) =
6565
match l with
6666
| Lprim {primitive = Pintcomp _ ;

0 commit comments

Comments
 (0)