Skip to content

Commit b4438c8

Browse files
committedAug 14, 2017
remove js_program_loader
1 parent 2b98402 commit b4438c8

8 files changed

+30
-158
lines changed
 

‎jscomp/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ CORE_SRCS= js_runtime_modules \
284284
lam_pass_deep_flatten\
285285
js_stmt_make js_pass_flatten\
286286
js_pass_tailcall_inline js_of_lam_variant js_pass_flatten_and_mark_dead js_ast_util lam_dce lam_group_pass lam_compile_env lam_stats_util\
287-
lam_stats_export lam_pass_alpha_conversion lam_pass_collect js_program_loader js_dump js_pass_debug\
287+
lam_stats_export lam_pass_alpha_conversion lam_pass_collect\
288+
js_dump js_pass_debug\
288289
js_of_lam_option js_output lam_compile_global \
289290
lam_dispatch_primitive \
290291
lam_bounded_vars\

‎jscomp/all.depend

+2-6
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,6 @@ core/lam_stats_export.cmi : core/lam_stats.cmi core/lam_module_ident.cmi \
333333
core/lam_pass_alpha_conversion.cmi : core/lam_stats.cmi core/lam.cmi
334334
core/lam_pass_collect.cmi : core/lam_stats.cmi core/lam.cmi \
335335
ext/ident_set.cmi
336-
core/js_program_loader.cmi : core/lam_module_ident.cmi \
337-
core/js_packages_info.cmi
338336
core/js_dump.cmi : core/js_packages_info.cmi core/j.cmx ext/ext_pp.cmi
339337
core/js_pass_debug.cmi : core/j.cmx
340338
core/js_of_lam_option.cmi : core/j.cmx
@@ -511,11 +509,9 @@ core/lam_pass_alpha_conversion.cmx : core/lam_stats_util.cmx \
511509
core/lam_pass_collect.cmx : core/lam_util.cmx core/lam_stats_util.cmx \
512510
core/lam_stats.cmx core/lam_arity.cmx core/lam.cmx ext/ident_set.cmx \
513511
ext/ident_hashtbl.cmx core/lam_pass_collect.cmi
514-
core/js_program_loader.cmx : core/lam_compile_env.cmx \
515-
core/js_packages_info.cmx core/js_program_loader.cmi
516512
core/js_dump.cmx : ext/literals.cmx core/lam_module_ident.cmx \
517-
core/js_stmt_make.cmx core/js_runtime_modules.cmx \
518-
core/js_program_loader.cmx core/js_packages_state.cmx \
513+
core/lam_compile_env.cmx core/js_stmt_make.cmx \
514+
core/js_runtime_modules.cmx core/js_packages_state.cmx \
519515
core/js_packages_info.cmx core/js_op_util.cmx core/js_op.cmx \
520516
core/js_number.cmx core/js_fun_env.cmx core/js_exp_make.cmx \
521517
common/js_config.cmx core/js_closure.cmx core/j.cmx ext/ident_set.cmx \

‎jscomp/core/js_cmj_format.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ let find_cmj file : string * t =
123123
"@[%s corrupted in database, when looking %s while compiling %s please update @]" file target (Js_config.get_current_file ()) ;
124124
Js_cmj_format.no_pure_dummy; (* FIXME *)
125125
| v -> v
126-
(* see {!Js_program_loader.string_of_module_id} *)
126+
(* see {!Js_packages_info.string_of_module_id} *)
127127
end
128128
| exception Not_found
129129
->

‎jscomp/core/js_dump.ml

+16-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@
2020
*)
2121
(* Authors: Jérôme Vouillon, Hongbo Zhang *)
2222

23-
23+
let string_of_module_id
24+
~hint_output_dir
25+
module_system
26+
id
27+
=
28+
Js_packages_info.string_of_module_id
29+
~hint_output_dir module_system
30+
(Js_packages_state.get_packages_info ())
31+
Lam_compile_env.get_package_path_from_cmj
32+
id
2433

2534
(*
2635
http://stackoverflow.com/questions/2846283/what-are-the-rules-for-javascripts-automatic-semicolon-insertion-asi
@@ -1103,7 +1112,7 @@ and
11031112
let action () =
11041113
let cxt = expression 15 cxt f e in
11051114
property_access f s ;
1106-
(* See [Js_program_loader.obj_of_exports]
1115+
(* See [ .obj_of_exports]
11071116
maybe in the ast level we should have
11081117
refer and export
11091118
*)
@@ -1792,12 +1801,11 @@ let goog_program ~output_prefix f goog_package (x : J.deps_program) =
17921801
(List.map
17931802
(fun x ->
17941803
Lam_module_ident.id x,
1795-
Js_program_loader.string_of_module_id
1804+
string_of_module_id
17961805
~hint_output_dir:(Filename.dirname output_prefix)
17971806
Goog
1798-
(Js_packages_state.get_packages_info())
17991807
x)
1800-
1808+
18011809
x.modules)
18021810
in
18031811
program f cxt x.program
@@ -1811,10 +1819,9 @@ let node_program ~output_prefix f ( x : J.deps_program) =
18111819
(List.map
18121820
(fun x ->
18131821
Lam_module_ident.id x,
1814-
Js_program_loader.string_of_module_id
1822+
string_of_module_id
18151823
~hint_output_dir:(Filename.dirname output_prefix)
18161824
NodeJS
1817-
(Js_packages_state.get_packages_info ())
18181825
x)
18191826
x.modules)
18201827
in
@@ -1831,10 +1838,9 @@ let amd_program ~output_prefix kind f ( x : J.deps_program) =
18311838

18321839
List.iter (fun x ->
18331840
let s : string =
1834-
Js_program_loader.string_of_module_id
1841+
string_of_module_id
18351842
~hint_output_dir:(Filename.dirname output_prefix)
18361843
kind
1837-
(Js_packages_state.get_packages_info ())
18381844
x in
18391845
P.string f L.comma ;
18401846
P.space f;
@@ -1872,10 +1878,9 @@ let es6_program ~output_prefix fmt f ( x : J.deps_program) =
18721878
(List.map
18731879
(fun x ->
18741880
Lam_module_ident.id x,
1875-
Js_program_loader.string_of_module_id
1881+
string_of_module_id
18761882
~hint_output_dir:(Filename.dirname output_prefix)
18771883
fmt
1878-
(Js_packages_state.get_packages_info())
18791884
x)
18801885
x.modules)
18811886
in

‎jscomp/core/js_packages_info.mli

+8
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ val add_npm_package_path :
5050
string -> t -> t
5151

5252

53+
54+
(**
55+
generate the mdoule path so that it can be spliced here:
56+
{[
57+
var Xx = require("package/path/to/xx.js")
58+
]}
59+
Note that it has to be consistent to how it is generated
60+
*)
5361
val string_of_module_id :
5462
hint_output_dir:string ->
5563
module_system ->

‎jscomp/core/js_program_loader.ml

-86
This file was deleted.

‎jscomp/core/js_program_loader.mli

-52
This file was deleted.

‎jscomp/core/lam_compile_env.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ let query_and_add_if_not_exist (type u)
247247
found {signature = []; pure = false}
248248
| No_env ->
249249
found (Ext_string.empty, Js_cmj_format.no_pure_dummy)
250-
(* FIXME: {!Js_program_loader} #154, it come from External, should be okay *)
250+
(* FIXME: #154, it come from External, should be okay *)
251251
end
252252

253253
end

0 commit comments

Comments
 (0)
Please sign in to comment.