Skip to content

Commit 018e503

Browse files
committed
tweak
1 parent 17a0284 commit 018e503

File tree

4 files changed

+38
-56
lines changed

4 files changed

+38
-56
lines changed

jscomp/core/js_pass_tailcall_inline.ml

+8-14
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,10 @@ let subst (export_set : Set_ident.t) stats =
124124
| Some _ -> self#statement st :: self#block rest
125125
end
126126

127-
| {statement_desc =
127+
| [{statement_desc =
128128
Return {return_value =
129129
{expression_desc =
130-
Call({expression_desc = Var (Id id)},args,_info)}} }
131-
as st
132-
:: rest
130+
Call({expression_desc = Var (Id id)},args,_info)}} } as st ]
133131
->
134132
begin match Hash_ident.find_opt stats id with
135133

@@ -144,21 +142,17 @@ let subst (export_set : Set_ident.t) stats =
144142
} as v)
145143
when Ext_list.same_length params args
146144
->
147-
(* Ext_log.dwarn __LOC__ "%s is dead \n %s " id.name *)
148-
(* (Js_dump.string_of_block [st]); *)
149145
Js_op_util.update_used_stats v.ident_info Dead_pure;
150-
let block =
151-
Ext_list.fold_right2
152-
params args ( self#block block) (* see #278 before changes*)
153-
(fun param arg acc ->
154-
S.define_variable ~kind:Variable param arg :: acc)
155-
in
146+
Ext_list.fold_right2
147+
params args ( self#block block) (* see #278 before changes*)
148+
(fun param arg acc ->
149+
S.define_variable ~kind:Variable param arg :: acc)
156150
(* Mark a function as dead means it will never be scanned,
157151
here we inline the function
158152
*)
159-
Ext_list.append block (self#block rest)
153+
160154
| (None | Some _) ->
161-
self#statement st :: self#block rest
155+
[self#statement st ]
162156
end
163157
| x :: xs
164158
->

lib/4.06.1/unstable/js_compiler.ml

+10-14
Original file line numberDiff line numberDiff line change
@@ -393183,12 +393183,12 @@ let subst (export_set : Set_ident.t) stats =
393183393183
| Some _ -> self#statement st :: self#block rest
393184393184
end
393185393185

393186-
| {statement_desc =
393186+
| [{statement_desc =
393187393187
Return {return_value =
393188393188
{expression_desc =
393189-
Call({expression_desc = Var (Id id)},args,_info)}} }
393190-
as st
393191-
:: rest
393189+
Call({expression_desc = Var (Id id)},args,_info)}} } as st ]
393190+
(* as st
393191+
:: rest *)
393192393192
->
393193393193
begin match Hash_ident.find_opt stats id with
393194393194

@@ -393203,21 +393203,17 @@ let subst (export_set : Set_ident.t) stats =
393203393203
} as v)
393204393204
when Ext_list.same_length params args
393205393205
->
393206-
(* Ext_log.dwarn __LOC__ "%s is dead \n %s " id.name *)
393207-
(* (Js_dump.string_of_block [st]); *)
393208393206
Js_op_util.update_used_stats v.ident_info Dead_pure;
393209-
let block =
393210-
Ext_list.fold_right2
393211-
params args ( self#block block) (* see #278 before changes*)
393212-
(fun param arg acc ->
393213-
S.define_variable ~kind:Variable param arg :: acc)
393214-
in
393207+
Ext_list.fold_right2
393208+
params args ( self#block block) (* see #278 before changes*)
393209+
(fun param arg acc ->
393210+
S.define_variable ~kind:Variable param arg :: acc)
393215393211
(* Mark a function as dead means it will never be scanned,
393216393212
here we inline the function
393217393213
*)
393218-
Ext_list.append block (self#block rest)
393214+
393219393215
| (None | Some _) ->
393220-
self#statement st :: self#block rest
393216+
[self#statement st ]
393221393217
end
393222393218
| x :: xs
393223393219
->

lib/4.06.1/unstable/js_refmt_compiler.ml

+10-14
Original file line numberDiff line numberDiff line change
@@ -393183,12 +393183,12 @@ let subst (export_set : Set_ident.t) stats =
393183393183
| Some _ -> self#statement st :: self#block rest
393184393184
end
393185393185

393186-
| {statement_desc =
393186+
| [{statement_desc =
393187393187
Return {return_value =
393188393188
{expression_desc =
393189-
Call({expression_desc = Var (Id id)},args,_info)}} }
393190-
as st
393191-
:: rest
393189+
Call({expression_desc = Var (Id id)},args,_info)}} } as st ]
393190+
(* as st
393191+
:: rest *)
393192393192
->
393193393193
begin match Hash_ident.find_opt stats id with
393194393194

@@ -393203,21 +393203,17 @@ let subst (export_set : Set_ident.t) stats =
393203393203
} as v)
393204393204
when Ext_list.same_length params args
393205393205
->
393206-
(* Ext_log.dwarn __LOC__ "%s is dead \n %s " id.name *)
393207-
(* (Js_dump.string_of_block [st]); *)
393208393206
Js_op_util.update_used_stats v.ident_info Dead_pure;
393209-
let block =
393210-
Ext_list.fold_right2
393211-
params args ( self#block block) (* see #278 before changes*)
393212-
(fun param arg acc ->
393213-
S.define_variable ~kind:Variable param arg :: acc)
393214-
in
393207+
Ext_list.fold_right2
393208+
params args ( self#block block) (* see #278 before changes*)
393209+
(fun param arg acc ->
393210+
S.define_variable ~kind:Variable param arg :: acc)
393215393211
(* Mark a function as dead means it will never be scanned,
393216393212
here we inline the function
393217393213
*)
393218-
Ext_list.append block (self#block rest)
393214+
393219393215
| (None | Some _) ->
393220-
self#statement st :: self#block rest
393216+
[self#statement st ]
393221393217
end
393222393218
| x :: xs
393223393219
->

lib/4.06.1/whole_compiler.ml

+10-14
Original file line numberDiff line numberDiff line change
@@ -387138,12 +387138,12 @@ let subst (export_set : Set_ident.t) stats =
387138387138
| Some _ -> self#statement st :: self#block rest
387139387139
end
387140387140

387141-
| {statement_desc =
387141+
| [{statement_desc =
387142387142
Return {return_value =
387143387143
{expression_desc =
387144-
Call({expression_desc = Var (Id id)},args,_info)}} }
387145-
as st
387146-
:: rest
387144+
Call({expression_desc = Var (Id id)},args,_info)}} } as st ]
387145+
(* as st
387146+
:: rest *)
387147387147
->
387148387148
begin match Hash_ident.find_opt stats id with
387149387149

@@ -387158,21 +387158,17 @@ let subst (export_set : Set_ident.t) stats =
387158387158
} as v)
387159387159
when Ext_list.same_length params args
387160387160
->
387161-
(* Ext_log.dwarn __LOC__ "%s is dead \n %s " id.name *)
387162-
(* (Js_dump.string_of_block [st]); *)
387163387161
Js_op_util.update_used_stats v.ident_info Dead_pure;
387164-
let block =
387165-
Ext_list.fold_right2
387166-
params args ( self#block block) (* see #278 before changes*)
387167-
(fun param arg acc ->
387168-
S.define_variable ~kind:Variable param arg :: acc)
387169-
in
387162+
Ext_list.fold_right2
387163+
params args ( self#block block) (* see #278 before changes*)
387164+
(fun param arg acc ->
387165+
S.define_variable ~kind:Variable param arg :: acc)
387170387166
(* Mark a function as dead means it will never be scanned,
387171387167
here we inline the function
387172387168
*)
387173-
Ext_list.append block (self#block rest)
387169+
387174387170
| (None | Some _) ->
387175-
self#statement st :: self#block rest
387171+
[self#statement st ]
387176387172
end
387177387173
| x :: xs
387178387174
->

0 commit comments

Comments
 (0)