Skip to content

Commit 4661e85

Browse files
authored
Merge pull request #4145 from BuckleScript/remove_unused_code
comment unused code
2 parents f2f4206 + f9fcebe commit 4661e85

28 files changed

+306
-298
lines changed

jscomp/common/bs_loc.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ let merge (l: t) (r : t) =
3939
->
4040
{loc_start ;loc_end; loc_ghost = false}
4141

42-
let none = Location.none
42+
(* let none = Location.none *)

jscomp/common/bs_loc.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type t = Location.t = {
2828
loc_ghost : bool
2929
}
3030

31-
val is_ghost : t -> bool
31+
(* val is_ghost : t -> bool *)
3232
val merge : t -> t -> t
33-
val none : t
33+
(* val none : t *)
3434

jscomp/common/js_config.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ let set_cross_module_inline b =
5959

6060
let diagnose = ref false
6161
let get_diagnose () = !diagnose
62-
let set_diagnose b = diagnose := b
62+
(* let set_diagnose b = diagnose := b *)
6363

6464
(* let (//) = Filename.concat *)
6565

jscomp/common/js_config.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ val get_cross_module_inline : unit -> bool
5454
(** diagnose option *)
5555
val diagnose : bool ref
5656
val get_diagnose : unit -> bool
57-
val set_diagnose : bool -> unit
57+
(* val set_diagnose : bool -> unit *)
5858

5959

6060
(** options for builtin ppx *)

jscomp/core/js_analyzer.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ let rev_toplevel_flatten block =
350350
| x :: xs -> aux (x :: acc) xs in
351351
aux [] block
352352

353-
let rec is_constant (x : J.expression) =
353+
(* let rec is_constant (x : J.expression) =
354354
match x.expression_desc with
355355
| Array_index (a,b) -> is_constant a && is_constant b
356356
| Str (b,_) -> b
@@ -360,7 +360,7 @@ let rec is_constant (x : J.expression) =
360360
-> Ext_list.for_all xs is_constant && is_constant tag
361361
| Bin (_op, a, b) ->
362362
is_constant a && is_constant b
363-
| _ -> false
363+
| _ -> false *)
364364

365365

366366
let rec is_okay_to_duplicate (e : J.expression) =

jscomp/core/js_analyzer.mli

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ val free_variables_of_statement :
4040
val free_variables_of_expression :
4141
Set_ident.t -> Set_ident.t -> J.finish_ident_expression -> Set_ident.t
4242

43-
val no_side_effect_expression_desc :
44-
J.expression_desc -> bool
43+
(* val no_side_effect_expression_desc :
44+
J.expression_desc -> bool *)
45+
4546
val no_side_effect_expression :
4647
J.expression -> bool
4748
(** [no_side_effect] means this expression has no side effect,
@@ -77,7 +78,7 @@ val rev_flatten_seq : J.expression -> J.block
7778
val rev_toplevel_flatten : J.block -> J.block
7879
(** return the block in reverse order *)
7980

80-
val is_constant : J.expression -> bool
81+
(* val is_constant : J.expression -> bool *)
8182

8283

8384
(** Simple expression,

jscomp/core/js_exp_make.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ let fuse_to_seq x xs =
326326
if xs = [] then x
327327
else Ext_list.fold_left xs x seq
328328

329-
let empty_string_literal : t =
330-
{expression_desc = Str (true,""); comment = None}
329+
(* let empty_string_literal : t =
330+
{expression_desc = Str (true,""); comment = None} *)
331331

332332
let zero_int_literal : t =
333333
{expression_desc = Number (Int {i = 0l; c = None}) ; comment = None}
@@ -506,15 +506,15 @@ let function_length ?comment (e : t) : t =
506506
| _ -> { expression_desc = Length (e, Function) ; comment }
507507

508508
(** no dependency introduced *)
509-
let js_global_dot ?comment (x : string) (e1 : string) : t =
509+
(* let js_global_dot ?comment (x : string) (e1 : string) : t =
510510
{ expression_desc = Static_index (js_global x, e1,None); comment}
511511
512512
let char_of_int ?comment (v : t) : t =
513513
match v.expression_desc with
514514
| Number (Int {i; _}) ->
515515
str (String.make 1(Char.chr (Int32.to_int i)))
516516
| Char_to_int v -> v
517-
| _ -> {comment ; expression_desc = Char_of_int v}
517+
| _ -> {comment ; expression_desc = Char_of_int v} *)
518518

519519
let char_to_int ?comment (v : t) : t =
520520
match v.expression_desc with

jscomp/core/js_exp_make.mli

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ val nint : ?comment:string -> nativeint -> t
119119
val small_int : int -> t
120120
val float : ?comment:string -> string -> t
121121

122-
val empty_string_literal : t
122+
(* val empty_string_literal : t *)
123123
(* TODO: we can do hash consing for small integers *)
124124
val zero_int_literal : t
125-
val one_int_literal : t
125+
(* val one_int_literal : t *)
126126
val zero_float_lit : t
127-
val obj_int_tag_literal : t
127+
(* val obj_int_tag_literal : t *)
128128

129129
(** [is_out e range] is equivalent to [e > range or e <0]
130130
@@ -147,7 +147,7 @@ val bytes_length : ?comment:string -> t -> t
147147

148148
val function_length : ?comment:string -> t -> t
149149

150-
val char_of_int : ?comment:string -> t -> t
150+
(* val char_of_int : ?comment:string -> t -> t *)
151151

152152
val char_to_int : ?comment:string -> t -> t
153153

@@ -164,7 +164,7 @@ val string_append : ?comment:string -> t -> t -> t
164164
(* val bind_var_call : ?comment:string -> Ident.t -> string -> t list -> t *)
165165

166166
(* val bind_call : ?comment:string -> J.expression -> string -> J.expression list -> t *)
167-
val js_global_dot : ?comment:string -> string -> string -> t
167+
(* val js_global_dot : ?comment:string -> string -> string -> t *)
168168

169169

170170

jscomp/core/js_fold_basic.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626

27-
class count_deps (add : Ident.t -> unit ) =
27+
(* class count_deps (add : Ident.t -> unit ) =
2828
object(self)
2929
inherit Js_fold.fold as super
3030
method! expression lam =
@@ -46,7 +46,7 @@ class count_deps (add : Ident.t -> unit ) =
4646
*)
4747
| _ -> super#expression lam
4848
method! ident x = add x ; self
49-
end
49+
end *)
5050

5151
let add_lam_module_ident = Lam_module_ident.Hash_set.add
5252
let create = Lam_module_ident.Hash_set.create
@@ -82,12 +82,12 @@ let calculate_hard_dependencies block =
8282
will not depend [variables]
8383
8484
*)
85-
let depends_j (lam : J.expression) (variables : Set_ident.t) =
85+
(* let depends_j (lam : J.expression) (variables : Set_ident.t) =
8686
let v = ref Set_ident.empty in
8787
let add id =
8888
if Set_ident.mem variables id then
8989
v := Set_ident.add !v id
9090
in
9191
ignore @@ (new count_deps add ) # expression lam ;
9292
!v
93-
93+
*)

jscomp/core/js_fold_basic.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
(** A module to calculate hard dependency based on JS IR in module [J] *)
2929

30-
val depends_j : J.expression -> Set_ident.t -> Set_ident.t
30+
(* val depends_j : J.expression -> Set_ident.t -> Set_ident.t *)
3131

3232
(** TODO: {!Ordered_hash_set} for better ordering *)
3333
val calculate_hard_dependencies : J.block -> Lam_module_ident.Hash_set.t

0 commit comments

Comments
 (0)