Skip to content

Commit 2df69f1

Browse files
committed
avoid creating a separate method add_use
1 parent ad7b09f commit 2df69f1

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

jscomp/core/js_pass_get_used.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25+
let add_use stats id =
26+
Hash_ident.add_or_update stats id 1 ~update:succ
2527

2628
(** Update ident info use cases, it is a non pure function,
2729
it will annotate [program] with some meta data
@@ -37,8 +39,6 @@ let count_collects my_export_set =
3739
(* collect all def sites *)
3840
val defined_idents : J.variable_declaration Hash_ident.t = Hash_ident.create 83
3941

40-
method add_use id =
41-
Hash_ident.add_or_update stats id 1 ~update:succ
4242
method! variable_declaration
4343
({ident; value ; property = _ ; ident_info = _} as v)
4444
=
@@ -48,7 +48,7 @@ let count_collects my_export_set =
4848
self
4949
| Some x
5050
-> self#expression x
51-
method! ident id = self#add_use id; self
51+
method! ident id = add_use stats id; self
5252
method get_stats =
5353
Hash_ident.iter defined_idents (fun ident v ->
5454
if Set_ident.mem my_export_set ident then

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102595,6 +102595,8 @@ end = struct
102595102595
* along with this program; if not, write to the Free Software
102596102596
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
102597102597

102598+
let add_use stats id =
102599+
Hash_ident.add_or_update stats id 1 ~update:succ
102598102600

102599102601
(** Update ident info use cases, it is a non pure function,
102600102602
it will annotate [program] with some meta data
@@ -102610,8 +102612,6 @@ let count_collects my_export_set =
102610102612
(* collect all def sites *)
102611102613
val defined_idents : J.variable_declaration Hash_ident.t = Hash_ident.create 83
102612102614

102613-
method add_use id =
102614-
Hash_ident.add_or_update stats id 1 ~update:succ
102615102615
method! variable_declaration
102616102616
({ident; value ; property = _ ; ident_info = _} as v)
102617102617
=
@@ -102621,7 +102621,7 @@ let count_collects my_export_set =
102621102621
self
102622102622
| Some x
102623102623
-> self#expression x
102624-
method! ident id = self#add_use id; self
102624+
method! ident id = add_use stats id; self
102625102625
method get_stats =
102626102626
Hash_ident.iter defined_idents (fun ident v ->
102627102627
if Set_ident.mem my_export_set ident then

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102595,6 +102595,8 @@ end = struct
102595102595
* along with this program; if not, write to the Free Software
102596102596
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
102597102597

102598+
let add_use stats id =
102599+
Hash_ident.add_or_update stats id 1 ~update:succ
102598102600

102599102601
(** Update ident info use cases, it is a non pure function,
102600102602
it will annotate [program] with some meta data
@@ -102604,14 +102606,12 @@ end = struct
102604102606
*)
102605102607
let count_collects my_export_set =
102606102608
object (self)
102607-
inherit Js_fold.fold as super
102609+
inherit Js_fold.fold
102608102610
(* collect used status*)
102609102611
val stats : int Hash_ident.t = Hash_ident.create 83
102610102612
(* collect all def sites *)
102611102613
val defined_idents : J.variable_declaration Hash_ident.t = Hash_ident.create 83
102612102614

102613-
method add_use id =
102614-
Hash_ident.add_or_update stats id 1 ~update:succ
102615102615
method! variable_declaration
102616102616
({ident; value ; property = _ ; ident_info = _} as v)
102617102617
=
@@ -102621,7 +102621,7 @@ let count_collects my_export_set =
102621102621
self
102622102622
| Some x
102623102623
-> self#expression x
102624-
method! ident id = self#add_use id; self
102624+
method! ident id = add_use stats id; self
102625102625
method get_stats =
102626102626
Hash_ident.iter defined_idents (fun ident v ->
102627102627
if Set_ident.mem my_export_set ident then

lib/4.06.1/whole_compiler.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385077,6 +385077,8 @@ end = struct
385077385077
* along with this program; if not, write to the Free Software
385078385078
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
385079385079

385080+
let add_use stats id =
385081+
Hash_ident.add_or_update stats id 1 ~update:succ
385080385082

385081385083
(** Update ident info use cases, it is a non pure function,
385082385084
it will annotate [program] with some meta data
@@ -385092,8 +385094,6 @@ let count_collects my_export_set =
385092385094
(* collect all def sites *)
385093385095
val defined_idents : J.variable_declaration Hash_ident.t = Hash_ident.create 83
385094385096

385095-
method add_use id =
385096-
Hash_ident.add_or_update stats id 1 ~update:succ
385097385097
method! variable_declaration
385098385098
({ident; value ; property = _ ; ident_info = _} as v)
385099385099
=
@@ -385103,7 +385103,7 @@ let count_collects my_export_set =
385103385103
self
385104385104
| Some x
385105385105
-> self#expression x
385106-
method! ident id = self#add_use id; self
385106+
method! ident id = add_use stats id; self
385107385107
method get_stats =
385108385108
Hash_ident.iter defined_idents (fun ident v ->
385109385109
if Set_ident.mem my_export_set ident then

0 commit comments

Comments
 (0)