Commit 8be95af480
Changed files (2)
src/analyze.cpp
@@ -5198,6 +5198,13 @@ static Error resolve_coro_frame(CodeGen *g, ZigType *frame_type) {
if (callee->body_node == nullptr) {
continue;
}
+ if (callee->anal_state == FnAnalStateProbing) {
+ ErrorMsg *msg = add_node_error(g, fn->proto_node,
+ buf_sprintf("unable to determine async function frame of '%s'", buf_ptr(&fn->symbol_name)));
+ add_error_note(g, msg, call->base.source_node,
+ buf_sprintf("analysis of function '%s' depends on the frame", buf_ptr(&callee->symbol_name)));
+ return ErrorSemanticAnalyzeFail;
+ }
analyze_fn_body(g, callee);
if (callee->anal_state == FnAnalStateInvalid) {
BRANCH_TODO
@@ -31,3 +31,8 @@
* grep for "coroutine" and "coro" and replace all that nomenclature with "async functions"
* when there are multiple calls to async functions in a function, reuse the same frame buffer, so that the
needed bytes is equal to the largest callee's frame
+ * if an async function is never called with async then a few optimizations can be made:
+ - the return does not need to be atomic
+ - it can be assumed that these are always available: the awaiter ptr, return ptr if applicable,
+ error return trace ptr if applicable.
+ - it can be assumed that it is never cancelled