Skip to content

Commit b6d7a6a

Browse files
committed
Clean up
1 parent 435dc83 commit b6d7a6a

File tree

2 files changed

+12
-48
lines changed

2 files changed

+12
-48
lines changed

jscomp/core/js_name_of_module_id.ml

+6-24
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let (=) (x : int) (y:float) = assert false
2828
(* "xx/lib/ocaml/js.cmj"
2929
Enhancement: This can be delegated to build system
3030
*)
31-
let runtime_package_path =
31+
let runtime_package_path : string Lazy.t =
3232
lazy (Filename.dirname (Filename.dirname
3333
(Filename.dirname
3434
(match Config_util.find_opt "js.cmj" with
@@ -47,14 +47,10 @@ let fix_path_for_windows : string -> string =
4747
let string_of_module_id
4848
(dep_module_id : Lam_module_ident.t)
4949
~(output_dir : string )
50-
(module_system : Js_packages_info.module_system)
51-
(current_package_info : Js_packages_info.t)
52-
(get_package_path_from_cmj :
53-
Lam_module_ident.t -> (string * Js_packages_info.t * Ext_namespace.file_kind) option
54-
)
55-
50+
(module_system : Js_packages_info.module_system)
5651
: string =
57-
fix_path_for_windows (
52+
let current_package_info = Js_packages_state.get_packages_info () in
53+
fix_path_for_windows (
5854
match dep_module_id.kind with
5955
| External name -> name (* the literal string for external package *)
6056
(** This may not be enough,
@@ -114,7 +110,7 @@ let string_of_module_id
114110
Js_packages_info.query_package_infos current_package_info
115111
module_system
116112
in
117-
match get_package_path_from_cmj dep_module_id with
113+
match Lam_compile_env.get_package_path_from_cmj dep_module_id with
118114
| None ->
119115
Bs_exception.error (Missing_ml_dependency dep_module_id.id.name)
120116
| Some (cmj_path, package_info, little) ->
@@ -202,7 +198,7 @@ let string_of_module_id
202198

203199

204200

205-
201+
(* Override it in browser *)
206202
#if BS_COMPILER_IN_BROWSER then
207203
let string_of_module_id_in_browser (x : Lam_module_ident.t) =
208204
match x.kind with
@@ -214,18 +210,4 @@ let string_of_module_id
214210
~output_dir:(_:string)
215211
(_module_system : Js_packages_info.module_system)
216212
= string_of_module_id_in_browser id
217-
#else
218-
219-
let string_of_module_id
220-
(id : Lam_module_ident.t)
221-
~output_dir
222-
module_system
223-
=
224-
string_of_module_id
225-
id
226-
~output_dir
227-
module_system
228-
(Js_packages_state.get_packages_info ())
229-
Lam_compile_env.get_package_path_from_cmj
230-
231213
#end

lib/whole_compiler.ml

+6-24
Original file line numberDiff line numberDiff line change
@@ -86209,7 +86209,7 @@ let (=) (x : int) (y:float) = assert false
8620986209
(* "xx/lib/ocaml/js.cmj"
8621086210
Enhancement: This can be delegated to build system
8621186211
*)
86212-
let runtime_package_path =
86212+
let runtime_package_path : string Lazy.t =
8621386213
lazy (Filename.dirname (Filename.dirname
8621486214
(Filename.dirname
8621586215
(match Config_util.find_opt "js.cmj" with
@@ -86228,14 +86228,10 @@ let fix_path_for_windows : string -> string =
8622886228
let string_of_module_id
8622986229
(dep_module_id : Lam_module_ident.t)
8623086230
~(output_dir : string )
86231-
(module_system : Js_packages_info.module_system)
86232-
(current_package_info : Js_packages_info.t)
86233-
(get_package_path_from_cmj :
86234-
Lam_module_ident.t -> (string * Js_packages_info.t * Ext_namespace.file_kind) option
86235-
)
86236-
86231+
(module_system : Js_packages_info.module_system)
8623786232
: string =
86238-
fix_path_for_windows (
86233+
let current_package_info = Js_packages_state.get_packages_info () in
86234+
fix_path_for_windows (
8623986235
match dep_module_id.kind with
8624086236
| External name -> name (* the literal string for external package *)
8624186237
(** This may not be enough,
@@ -86295,7 +86291,7 @@ let string_of_module_id
8629586291
Js_packages_info.query_package_infos current_package_info
8629686292
module_system
8629786293
in
86298-
match get_package_path_from_cmj dep_module_id with
86294+
match Lam_compile_env.get_package_path_from_cmj dep_module_id with
8629986295
| None ->
8630086296
Bs_exception.error (Missing_ml_dependency dep_module_id.id.name)
8630186297
| Some (cmj_path, package_info, little) ->
@@ -86373,21 +86369,7 @@ let string_of_module_id
8637386369

8637486370

8637586371

86376-
86377-
86378-
86379-
let string_of_module_id
86380-
(id : Lam_module_ident.t)
86381-
~output_dir
86382-
module_system
86383-
=
86384-
string_of_module_id
86385-
id
86386-
~output_dir
86387-
module_system
86388-
(Js_packages_state.get_packages_info ())
86389-
Lam_compile_env.get_package_path_from_cmj
86390-
86372+
(* Override it in browser *)
8639186373

8639286374

8639386375
end

0 commit comments

Comments
 (0)