Skip to content

Commit ad7b09f

Browse files
committed
clean up object usage
1 parent d1b7326 commit ad7b09f

File tree

4 files changed

+11
-31
lines changed

4 files changed

+11
-31
lines changed

jscomp/core/js_pass_get_used.ml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,16 @@
2929
since in this case it can not be global?
3030
3131
*)
32-
let count_collects () =
32+
let count_collects my_export_set =
3333
object (self)
34-
inherit Js_fold.fold as super
34+
inherit Js_fold.fold
3535
(* collect used status*)
3636
val stats : int Hash_ident.t = Hash_ident.create 83
3737
(* collect all def sites *)
3838
val defined_idents : J.variable_declaration Hash_ident.t = Hash_ident.create 83
3939

40-
val mutable my_export_set : Set_ident.t = Set_ident.empty
41-
4240
method add_use id =
4341
Hash_ident.add_or_update stats id 1 ~update:succ
44-
method! program x =
45-
my_export_set <- x.export_set ;
46-
super#program x
4742
method! variable_declaration
4843
({ident; value ; property = _ ; ident_info = _} as v)
4944
=
@@ -76,5 +71,5 @@ let count_collects () =
7671

7772

7873
let get_stats (program : J.program) : J.variable_declaration Hash_ident.t
79-
= ((count_collects ()) #program program) #get_stats
74+
= ((count_collects program.export_set) #program program) #get_stats
8075

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102602,21 +102602,16 @@ end = struct
102602102602
since in this case it can not be global?
102603102603

102604102604
*)
102605-
let count_collects () =
102605+
let count_collects my_export_set =
102606102606
object (self)
102607-
inherit Js_fold.fold as super
102607+
inherit Js_fold.fold
102608102608
(* collect used status*)
102609102609
val stats : int Hash_ident.t = Hash_ident.create 83
102610102610
(* collect all def sites *)
102611102611
val defined_idents : J.variable_declaration Hash_ident.t = Hash_ident.create 83
102612102612

102613-
val mutable my_export_set : Set_ident.t = Set_ident.empty
102614-
102615102613
method add_use id =
102616102614
Hash_ident.add_or_update stats id 1 ~update:succ
102617-
method! program x =
102618-
my_export_set <- x.export_set ;
102619-
super#program x
102620102615
method! variable_declaration
102621102616
({ident; value ; property = _ ; ident_info = _} as v)
102622102617
=
@@ -102649,7 +102644,7 @@ let count_collects () =
102649102644

102650102645

102651102646
let get_stats (program : J.program) : J.variable_declaration Hash_ident.t
102652-
= ((count_collects ()) #program program) #get_stats
102647+
= ((count_collects program.export_set) #program program) #get_stats
102653102648

102654102649
end
102655102650
module Js_pass_tailcall_inline : sig

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102602,21 +102602,16 @@ end = struct
102602102602
since in this case it can not be global?
102603102603

102604102604
*)
102605-
let count_collects () =
102605+
let count_collects my_export_set =
102606102606
object (self)
102607102607
inherit Js_fold.fold as super
102608102608
(* collect used status*)
102609102609
val stats : int Hash_ident.t = Hash_ident.create 83
102610102610
(* collect all def sites *)
102611102611
val defined_idents : J.variable_declaration Hash_ident.t = Hash_ident.create 83
102612102612

102613-
val mutable my_export_set : Set_ident.t = Set_ident.empty
102614-
102615102613
method add_use id =
102616102614
Hash_ident.add_or_update stats id 1 ~update:succ
102617-
method! program x =
102618-
my_export_set <- x.export_set ;
102619-
super#program x
102620102615
method! variable_declaration
102621102616
({ident; value ; property = _ ; ident_info = _} as v)
102622102617
=
@@ -102649,7 +102644,7 @@ let count_collects () =
102649102644

102650102645

102651102646
let get_stats (program : J.program) : J.variable_declaration Hash_ident.t
102652-
= ((count_collects ()) #program program) #get_stats
102647+
= ((count_collects program.export_set) #program program) #get_stats
102653102648

102654102649
end
102655102650
module Js_pass_tailcall_inline : sig

lib/4.06.1/whole_compiler.ml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385084,21 +385084,16 @@ end = struct
385084385084
since in this case it can not be global?
385085385085

385086385086
*)
385087-
let count_collects () =
385087+
let count_collects my_export_set =
385088385088
object (self)
385089-
inherit Js_fold.fold as super
385089+
inherit Js_fold.fold
385090385090
(* collect used status*)
385091385091
val stats : int Hash_ident.t = Hash_ident.create 83
385092385092
(* collect all def sites *)
385093385093
val defined_idents : J.variable_declaration Hash_ident.t = Hash_ident.create 83
385094385094

385095-
val mutable my_export_set : Set_ident.t = Set_ident.empty
385096-
385097385095
method add_use id =
385098385096
Hash_ident.add_or_update stats id 1 ~update:succ
385099-
method! program x =
385100-
my_export_set <- x.export_set ;
385101-
super#program x
385102385097
method! variable_declaration
385103385098
({ident; value ; property = _ ; ident_info = _} as v)
385104385099
=
@@ -385131,7 +385126,7 @@ let count_collects () =
385131385126

385132385127

385133385128
let get_stats (program : J.program) : J.variable_declaration Hash_ident.t
385134-
= ((count_collects ()) #program program) #get_stats
385129+
= ((count_collects program.export_set) #program program) #get_stats
385135385130

385136385131
end
385137385132
module Js_pass_tailcall_inline : sig

0 commit comments

Comments
 (0)