@@ -43,8 +43,8 @@ type meta_info =
43
43
let mark_dead_code (js : J.program ) : J.program =
44
44
let ident_use_stats : meta_info Hash_ident. t
45
45
= Hash_ident. create 17 in
46
- let mark_dead : Js_fold.fold = object (self )
47
- inherit Js_fold. fold
46
+ let mark_dead : Js_iter.iter = object (self )
47
+ inherit Js_iter. iter
48
48
method! ident ident =
49
49
(match Hash_ident. find_opt ident_use_stats ident with
50
50
| None -> (* First time *)
@@ -53,22 +53,21 @@ let mark_dead_code (js : J.program) : J.program =
53
53
| Some Recursive
54
54
-> ()
55
55
| Some (Info x ) -> Js_op_util. update_used_stats x Used )
56
- ; self
57
56
method! variable_declaration vd =
58
57
match vd.ident_info.used_stats with
59
58
| Dead_pure
60
- -> self
59
+ -> ()
61
60
| Dead_non_pure ->
62
61
begin match vd.value with
63
- | None -> self
62
+ | None -> ()
64
63
| Some x -> self#expression x
65
64
end
66
65
| _ ->
67
66
let ({ident; ident_info ; value ; _} : J.variable_declaration ) = vd in
68
67
let pure =
69
68
match value with
70
69
| None -> true
71
- | Some x -> ignore (self#expression x); Js_analyzer. no_side_effect_expression x in
70
+ | Some x -> (self#expression x); Js_analyzer. no_side_effect_expression x in
72
71
(
73
72
let () =
74
73
if Set_ident. mem js.export_set ident then
@@ -87,9 +86,9 @@ let mark_dead_code (js : J.program) : J.program =
87
86
| None -> (* First time *)
88
87
Hash_ident. add ident_use_stats ident (Info ident_info);
89
88
Js_op_util. update_used_stats ident_info
90
- (if pure then Scanning_pure else Scanning_non_pure )); self
89
+ (if pure then Scanning_pure else Scanning_non_pure ))
91
90
end in
92
- let _ = (mark_dead#program js) in
91
+ let () = (mark_dead#program js) in
93
92
Hash_ident. iter ident_use_stats (fun _id (info : meta_info ) ->
94
93
match info with
95
94
| Info ({used_stats = Scanning_pure } as info ) ->
0 commit comments