File tree Expand file tree Collapse file tree 7 files changed +46
-12
lines changed Expand file tree Collapse file tree 7 files changed +46
-12
lines changed Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ let subst (export_set : Set_ident.t) stats =
200200 Call
201201 ( {
202202 expression_desc =
203- Fun {is_method= false ; params; body; env};
203+ Fun {is_method= false ; params; body; env; async = false };
204204 },
205205 args,
206206 _info );
Original file line number Diff line number Diff line change @@ -128,7 +128,10 @@ let simplify_alias (meta : Lam_stats.t) (lam : Lam.t) : Lam.t =
128128 ap_info;
129129 } -> (
130130 match Lam_compile_env. query_external_id_info ident fld_name with
131- | { persistent_closed_lambda = Some (Lfunction { params; body; _ }) }
131+ | {
132+ persistent_closed_lambda =
133+ Some (Lfunction ({ params; body } as lfunction));
134+ }
132135 (* be more cautious when do cross module inlining *)
133136 when Ext_list. same_length params args
134137 && Ext_list. for_all args (fun arg ->
@@ -137,7 +140,8 @@ let simplify_alias (meta : Lam_stats.t) (lam : Lam.t) : Lam.t =
137140 match Hash_ident. find_opt meta.ident_tbl p with
138141 | Some v -> v <> Parameter
139142 | None -> true )
140- | _ -> true ) ->
143+ | _ -> true )
144+ && Lam_analysis. lfunction_can_be_beta_reduced lfunction ->
141145 simpl (Lam_beta_reduce. propagate_beta_reduce meta params body args)
142146 | _ -> Lam. apply (simpl l1) (Ext_list. map args simpl) ap_info)
143147 (* Function inlining interact with other optimizations...
Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ function wrapSomethingAsync(param) {
1515 } ) ( 777 ) ) ;
1616}
1717
18+ function wrapSomethingAsync2 ( param ) {
19+ ( ( async function ( param ) {
20+ var test = await Promise . resolve ( "Test" ) ;
21+ console . log ( test ) ;
22+ } ) ( undefined ) ) ;
23+ }
24+
1825async function doSomethingAsync ( someAsyncFunction ) {
1926 return await Curry . _1 ( someAsyncFunction , undefined ) ;
2027}
@@ -34,6 +41,7 @@ var broken$2 = broken$1;
3441exports . willBeInlined = willBeInlined ;
3542exports . inlined = inlined ;
3643exports . wrapSomethingAsync = wrapSomethingAsync ;
44+ exports . wrapSomethingAsync2 = wrapSomethingAsync2 ;
3745exports . M = M ;
3846exports . broken = broken$2 ;
3947/* inlined Not a pure module */
Original file line number Diff line number Diff line change @@ -11,6 +11,16 @@ let wrapSomethingAsync: unit => unit = () => {
1111 )(777 )
1212}
1313
14+ external ignorePromise : promise <'a > => unit = "%identity"
15+
16+ let wrapSomethingAsync2 = () =>
17+ (
18+ async () => {
19+ let test = await Js .Promise .resolve ("Test" )
20+ Js .log (test )
21+ }
22+ )()-> ignorePromise
23+
1424module M : {
1525 let broken : (unit => promise <'a >) => promise <'a >
1626} = {
Original file line number Diff line number Diff line change @@ -92813,7 +92813,7 @@ let subst (export_set : Set_ident.t) stats =
9281392813 Call
9281492814 ( {
9281592815 expression_desc =
92816- Fun {is_method=false; params; body; env};
92816+ Fun {is_method=false; params; body; env; async=false };
9281792817 },
9281892818 args,
9281992819 _info );
@@ -260296,7 +260296,10 @@ let simplify_alias (meta : Lam_stats.t) (lam : Lam.t) : Lam.t =
260296260296 ap_info;
260297260297 } -> (
260298260298 match Lam_compile_env.query_external_id_info ident fld_name with
260299- | { persistent_closed_lambda = Some (Lfunction { params; body; _ }) }
260299+ | {
260300+ persistent_closed_lambda =
260301+ Some (Lfunction ({ params; body } as lfunction));
260302+ }
260300260303 (* be more cautious when do cross module inlining *)
260301260304 when Ext_list.same_length params args
260302260305 && Ext_list.for_all args (fun arg ->
@@ -260305,7 +260308,8 @@ let simplify_alias (meta : Lam_stats.t) (lam : Lam.t) : Lam.t =
260305260308 match Hash_ident.find_opt meta.ident_tbl p with
260306260309 | Some v -> v <> Parameter
260307260310 | None -> true)
260308- | _ -> true) ->
260311+ | _ -> true)
260312+ && Lam_analysis.lfunction_can_be_beta_reduced lfunction ->
260309260313 simpl (Lam_beta_reduce.propagate_beta_reduce meta params body args)
260310260314 | _ -> Lam.apply (simpl l1) (Ext_list.map args simpl) ap_info)
260311260315 (* Function inlining interact with other optimizations...
Original file line number Diff line number Diff line change @@ -92813,7 +92813,7 @@ let subst (export_set : Set_ident.t) stats =
9281392813 Call
9281492814 ( {
9281592815 expression_desc =
92816- Fun {is_method=false; params; body; env};
92816+ Fun {is_method=false; params; body; env; async=false };
9281792817 },
9281892818 args,
9281992819 _info );
@@ -260296,7 +260296,10 @@ let simplify_alias (meta : Lam_stats.t) (lam : Lam.t) : Lam.t =
260296260296 ap_info;
260297260297 } -> (
260298260298 match Lam_compile_env.query_external_id_info ident fld_name with
260299- | { persistent_closed_lambda = Some (Lfunction { params; body; _ }) }
260299+ | {
260300+ persistent_closed_lambda =
260301+ Some (Lfunction ({ params; body } as lfunction));
260302+ }
260300260303 (* be more cautious when do cross module inlining *)
260301260304 when Ext_list.same_length params args
260302260305 && Ext_list.for_all args (fun arg ->
@@ -260305,7 +260308,8 @@ let simplify_alias (meta : Lam_stats.t) (lam : Lam.t) : Lam.t =
260305260308 match Hash_ident.find_opt meta.ident_tbl p with
260306260309 | Some v -> v <> Parameter
260307260310 | None -> true)
260308- | _ -> true) ->
260311+ | _ -> true)
260312+ && Lam_analysis.lfunction_can_be_beta_reduced lfunction ->
260309260313 simpl (Lam_beta_reduce.propagate_beta_reduce meta params body args)
260310260314 | _ -> Lam.apply (simpl l1) (Ext_list.map args simpl) ap_info)
260311260315 (* Function inlining interact with other optimizations...
Original file line number Diff line number Diff line change @@ -262174,7 +262174,7 @@ let subst (export_set : Set_ident.t) stats =
262174262174 Call
262175262175 ( {
262176262176 expression_desc =
262177- Fun {is_method=false; params; body; env};
262177+ Fun {is_method=false; params; body; env; async=false };
262178262178 },
262179262179 args,
262180262180 _info );
@@ -275566,7 +275566,10 @@ let simplify_alias (meta : Lam_stats.t) (lam : Lam.t) : Lam.t =
275566275566 ap_info;
275567275567 } -> (
275568275568 match Lam_compile_env.query_external_id_info ident fld_name with
275569- | { persistent_closed_lambda = Some (Lfunction { params; body; _ }) }
275569+ | {
275570+ persistent_closed_lambda =
275571+ Some (Lfunction ({ params; body } as lfunction));
275572+ }
275570275573 (* be more cautious when do cross module inlining *)
275571275574 when Ext_list.same_length params args
275572275575 && Ext_list.for_all args (fun arg ->
@@ -275575,7 +275578,8 @@ let simplify_alias (meta : Lam_stats.t) (lam : Lam.t) : Lam.t =
275575275578 match Hash_ident.find_opt meta.ident_tbl p with
275576275579 | Some v -> v <> Parameter
275577275580 | None -> true)
275578- | _ -> true) ->
275581+ | _ -> true)
275582+ && Lam_analysis.lfunction_can_be_beta_reduced lfunction ->
275579275583 simpl (Lam_beta_reduce.propagate_beta_reduce meta params body args)
275580275584 | _ -> Lam.apply (simpl l1) (Ext_list.map args simpl) ap_info)
275581275585 (* Function inlining interact with other optimizations...
You can’t perform that action at this time.
0 commit comments