| author | |
| committer | |
| log | 9a18db8a80c96d206297e865d203b2a7d8a803ba |
| tree | 925f672055188b9241f2161ce2db60168d691805 |
| parent | d1a98ccff481183d7fc53e45a902ef273c3d6aeb |
| signature |
2 files changed, 17 insertions(+), 0 deletions(-)
src/analyze.cpp+2| ... | @@ -5883,6 +5883,8 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) { | ... | @@ -5883,6 +5883,8 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) { |
| 5883 | if (!fn_is_async(callee)) | 5883 | if (!fn_is_async(callee)) |
| 5884 | continue; | 5884 | continue; |
| 5885 | 5885 | ||
| 5886 | mark_suspension_point(call->base.scope); | ||
| 5887 | |||
| 5886 | call->frame_result_loc = ir_create_alloca(g, call->base.scope, call->base.source_node, fn, | 5888 | call->frame_result_loc = ir_create_alloca(g, call->base.scope, call->base.source_node, fn, |
| 5887 | callee_frame_type, ""); | 5889 | callee_frame_type, ""); |
| 5888 | } | 5890 | } |
test/stage1/behavior/async_fn.zig+15| ... | @@ -1136,3 +1136,18 @@ test "await used in expression after a fn call" { | ... | @@ -1136,3 +1136,18 @@ test "await used in expression after a fn call" { |
| 1136 | }; | 1136 | }; |
| 1137 | _ = async S.atest(); | 1137 | _ = async S.atest(); |
| 1138 | } | 1138 | } |
| 1139 | |||
| 1140 | test "async fn call used in expression after a fn call" { | ||
| 1141 | const S = struct { | ||
| 1142 | fn atest() void { | ||
| 1143 | var sum: i32 = 0; | ||
| 1144 | sum = foo() + add(3, 4); | ||
| 1145 | expect(sum == 8); | ||
| 1146 | } | ||
| 1147 | async fn add(a: i32, b: i32) i32 { | ||
| 1148 | return a + b; | ||
| 1149 | } | ||
| 1150 | fn foo() i32 { return 1; } | ||
| 1151 | }; | ||
| 1152 | _ = async S.atest(); | ||
| 1153 | } |