Skip to content

Commit 5ef1ffa

Browse files
committed
Remove unused code
1 parent b0a7894 commit 5ef1ffa

File tree

5 files changed

+54
-165
lines changed

5 files changed

+54
-165
lines changed

jscomp/core/js_cmj_format.ml

-14
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,7 @@ let cmj_magic_number = "BUCKLE20171012"
6767
let cmj_magic_number_length =
6868
String.length cmj_magic_number
6969

70-
let pure_dummy =
71-
{
72-
values = empty_values;
73-
pure = true;
74-
npm_package_path = Js_packages_info.empty;
75-
cmj_case = Little_js;
76-
}
7770

78-
let no_pure_dummy =
79-
{
80-
values = empty_values;
81-
pure = false;
82-
npm_package_path = Js_packages_info.empty;
83-
cmj_case = Little_js; (** TODO: consistent with Js_config.bs_suffix default *)
84-
}
8571

8672
let digest_length = 16 (*16 chars *)
8773

jscomp/core/js_cmj_format.mli

+1-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ val get_cmj_case :
9393
cmj_case
9494

9595
val single_na : arity
96-
val pure_dummy : t
97-
val no_pure_dummy : t
96+
9897

9998

10099
val from_file : string -> t

jscomp/core/lam_compile_env.ml

+17-39
Original file line numberDiff line numberDiff line change
@@ -153,42 +153,7 @@ type _ t =
153153
| Has_env : Env.t -> bool t (* Indicate it is pure or not *)
154154

155155

156-
(*
157-
FIXME:
158-
Here [not_found] only means cmi not found, not cmj not found
159-
We do need handle cases when [not_found] hit in a graceful way
160-
*)
161-
let query_and_add_if_not_exist
162-
(type u)
163-
(oid : Lam_module_ident.t)
164-
=
165-
match Lam_module_ident.Hash.find_opt cached_tbl oid with
166-
| None ->
167-
begin match oid.kind with
168-
| Runtime ->
169-
let (cmj_path, cmj_table) as cmj_info =
170-
Js_cmj_load.find_cmj_exn (Lam_module_ident.name oid ^ Literals.suffix_cmj) in
171-
oid +> Runtime {cmj_path;cmj_table} ;
172-
Js_cmj_format.is_pure cmj_table
173-
| Ml
174-
->
175-
let (cmj_path, cmj_table) as cmj_info =
176-
Js_cmj_load.find_cmj_exn (Lam_module_ident.name oid ^ Literals.suffix_cmj) in
177-
oid +> Ml {cmj_table;cmj_path } ;
178-
Js_cmj_format.is_pure cmj_table
179-
| External _ ->
180-
oid +> External;
181-
(** This might be wrong, if we happen to expand an js module
182-
we should assert false (but this in general should not happen)
183-
FIXME: #154, it come from External, should be okay
184-
*)
185-
false
186-
end
187-
| Some (Ml { cmj_table })
188-
| Some (Runtime {cmj_table}) ->
189-
Js_cmj_format.is_pure cmj_table
190-
| Some External -> false
191-
156+
192157

193158

194159

@@ -224,10 +189,23 @@ let get_package_path_from_cmj
224189
let add = Lam_module_ident.Hash_set.add
225190

226191

192+
227193
(* Conservative interface *)
228-
let is_pure_module (id : Lam_module_ident.t) =
229-
id.kind = Runtime ||
230-
query_and_add_if_not_exist id
194+
let is_pure_module (oid : Lam_module_ident.t) =
195+
match oid.kind with
196+
| Runtime -> true
197+
| External _ -> false
198+
| Ml ->
199+
begin match Lam_module_ident.Hash.find_opt cached_tbl oid with
200+
| None ->
201+
let (cmj_path, cmj_table) =
202+
Js_cmj_load.find_cmj_exn (Lam_module_ident.name oid ^ Literals.suffix_cmj) in
203+
oid +> Ml {cmj_table;cmj_path } ;
204+
Js_cmj_format.is_pure cmj_table
205+
| Some (Ml{cmj_table}|Runtime {cmj_table}) ->
206+
Js_cmj_format.is_pure cmj_table
207+
| Some External -> false
208+
end
231209

232210

233211
let get_required_modules

lib/4.02.3/unstable/js_compiler.ml

+18-55
Original file line numberDiff line numberDiff line change
@@ -76016,8 +76016,7 @@ val get_cmj_case :
7601676016
cmj_case
7601776017

7601876018
val single_na : arity
76019-
val pure_dummy : t
76020-
val no_pure_dummy : t
76019+
7602176020

7602276021

7602376022
val from_file : string -> t
@@ -76104,21 +76103,7 @@ let cmj_magic_number = "BUCKLE20171012"
7610476103
let cmj_magic_number_length =
7610576104
String.length cmj_magic_number
7610676105

76107-
let pure_dummy =
76108-
{
76109-
values = empty_values;
76110-
pure = true;
76111-
npm_package_path = Js_packages_info.empty;
76112-
cmj_case = Little_js;
76113-
}
7611476106

76115-
let no_pure_dummy =
76116-
{
76117-
values = empty_values;
76118-
pure = false;
76119-
npm_package_path = Js_packages_info.empty;
76120-
cmj_case = Little_js; (** TODO: consistent with Js_config.bs_suffix default *)
76121-
}
7612276107

7612376108
let digest_length = 16 (*16 chars *)
7612476109

@@ -96600,42 +96585,7 @@ type _ t =
9660096585
| Has_env : Env.t -> bool t (* Indicate it is pure or not *)
9660196586

9660296587

96603-
(*
96604-
FIXME:
96605-
Here [not_found] only means cmi not found, not cmj not found
96606-
We do need handle cases when [not_found] hit in a graceful way
96607-
*)
96608-
let query_and_add_if_not_exist
96609-
(type u)
96610-
(oid : Lam_module_ident.t)
96611-
=
96612-
match Lam_module_ident.Hash.find_opt cached_tbl oid with
96613-
| None ->
96614-
begin match oid.kind with
96615-
| Runtime ->
96616-
let (cmj_path, cmj_table) as cmj_info =
96617-
Js_cmj_load.find_cmj_exn (Lam_module_ident.name oid ^ Literals.suffix_cmj) in
96618-
oid +> Runtime {cmj_path;cmj_table} ;
96619-
Js_cmj_format.is_pure cmj_table
96620-
| Ml
96621-
->
96622-
let (cmj_path, cmj_table) as cmj_info =
96623-
Js_cmj_load.find_cmj_exn (Lam_module_ident.name oid ^ Literals.suffix_cmj) in
96624-
oid +> Ml {cmj_table;cmj_path } ;
96625-
Js_cmj_format.is_pure cmj_table
96626-
| External _ ->
96627-
oid +> External;
96628-
(** This might be wrong, if we happen to expand an js module
96629-
we should assert false (but this in general should not happen)
96630-
FIXME: #154, it come from External, should be okay
96631-
*)
96632-
false
96633-
end
96634-
| Some (Ml { cmj_table })
96635-
| Some (Runtime {cmj_table}) ->
96636-
Js_cmj_format.is_pure cmj_table
96637-
| Some External -> false
96638-
96588+
9663996589

9664096590

9664196591

@@ -96671,10 +96621,23 @@ let get_package_path_from_cmj
9667196621
let add = Lam_module_ident.Hash_set.add
9667296622

9667396623

96624+
9667496625
(* Conservative interface *)
96675-
let is_pure_module (id : Lam_module_ident.t) =
96676-
id.kind = Runtime ||
96677-
query_and_add_if_not_exist id
96626+
let is_pure_module (oid : Lam_module_ident.t) =
96627+
match oid.kind with
96628+
| Runtime -> true
96629+
| External _ -> false
96630+
| Ml ->
96631+
begin match Lam_module_ident.Hash.find_opt cached_tbl oid with
96632+
| None ->
96633+
let (cmj_path, cmj_table) =
96634+
Js_cmj_load.find_cmj_exn (Lam_module_ident.name oid ^ Literals.suffix_cmj) in
96635+
oid +> Ml {cmj_table;cmj_path } ;
96636+
Js_cmj_format.is_pure cmj_table
96637+
| Some (Ml{cmj_table}|Runtime {cmj_table}) ->
96638+
Js_cmj_format.is_pure cmj_table
96639+
| Some External -> false
96640+
end
9667896641

9667996642

9668096643
let get_required_modules

lib/4.02.3/whole_compiler.ml

+18-55
Original file line numberDiff line numberDiff line change
@@ -67589,8 +67589,7 @@ val get_cmj_case :
6758967589
cmj_case
6759067590

6759167591
val single_na : arity
67592-
val pure_dummy : t
67593-
val no_pure_dummy : t
67592+
6759467593

6759567594

6759667595
val from_file : string -> t
@@ -67677,21 +67676,7 @@ let cmj_magic_number = "BUCKLE20171012"
6767767676
let cmj_magic_number_length =
6767867677
String.length cmj_magic_number
6767967678

67680-
let pure_dummy =
67681-
{
67682-
values = empty_values;
67683-
pure = true;
67684-
npm_package_path = Js_packages_info.empty;
67685-
cmj_case = Little_js;
67686-
}
6768767679

67688-
let no_pure_dummy =
67689-
{
67690-
values = empty_values;
67691-
pure = false;
67692-
npm_package_path = Js_packages_info.empty;
67693-
cmj_case = Little_js; (** TODO: consistent with Js_config.bs_suffix default *)
67694-
}
6769567680

6769667681
let digest_length = 16 (*16 chars *)
6769767682

@@ -83984,42 +83969,7 @@ type _ t =
8398483969
| Has_env : Env.t -> bool t (* Indicate it is pure or not *)
8398583970

8398683971

83987-
(*
83988-
FIXME:
83989-
Here [not_found] only means cmi not found, not cmj not found
83990-
We do need handle cases when [not_found] hit in a graceful way
83991-
*)
83992-
let query_and_add_if_not_exist
83993-
(type u)
83994-
(oid : Lam_module_ident.t)
83995-
=
83996-
match Lam_module_ident.Hash.find_opt cached_tbl oid with
83997-
| None ->
83998-
begin match oid.kind with
83999-
| Runtime ->
84000-
let (cmj_path, cmj_table) as cmj_info =
84001-
Js_cmj_load.find_cmj_exn (Lam_module_ident.name oid ^ Literals.suffix_cmj) in
84002-
oid +> Runtime {cmj_path;cmj_table} ;
84003-
Js_cmj_format.is_pure cmj_table
84004-
| Ml
84005-
->
84006-
let (cmj_path, cmj_table) as cmj_info =
84007-
Js_cmj_load.find_cmj_exn (Lam_module_ident.name oid ^ Literals.suffix_cmj) in
84008-
oid +> Ml {cmj_table;cmj_path } ;
84009-
Js_cmj_format.is_pure cmj_table
84010-
| External _ ->
84011-
oid +> External;
84012-
(** This might be wrong, if we happen to expand an js module
84013-
we should assert false (but this in general should not happen)
84014-
FIXME: #154, it come from External, should be okay
84015-
*)
84016-
false
84017-
end
84018-
| Some (Ml { cmj_table })
84019-
| Some (Runtime {cmj_table}) ->
84020-
Js_cmj_format.is_pure cmj_table
84021-
| Some External -> false
84022-
83972+
8402383973

8402483974

8402583975

@@ -84055,10 +84005,23 @@ let get_package_path_from_cmj
8405584005
let add = Lam_module_ident.Hash_set.add
8405684006

8405784007

84008+
8405884009
(* Conservative interface *)
84059-
let is_pure_module (id : Lam_module_ident.t) =
84060-
id.kind = Runtime ||
84061-
query_and_add_if_not_exist id
84010+
let is_pure_module (oid : Lam_module_ident.t) =
84011+
match oid.kind with
84012+
| Runtime -> true
84013+
| External _ -> false
84014+
| Ml ->
84015+
begin match Lam_module_ident.Hash.find_opt cached_tbl oid with
84016+
| None ->
84017+
let (cmj_path, cmj_table) =
84018+
Js_cmj_load.find_cmj_exn (Lam_module_ident.name oid ^ Literals.suffix_cmj) in
84019+
oid +> Ml {cmj_table;cmj_path } ;
84020+
Js_cmj_format.is_pure cmj_table
84021+
| Some (Ml{cmj_table}|Runtime {cmj_table}) ->
84022+
Js_cmj_format.is_pure cmj_table
84023+
| Some External -> false
84024+
end
8406284025

8406384026

8406484027
let get_required_modules

0 commit comments

Comments
 (0)