diff options
| -rw-r--r-- | BRANCH_TODO | 5 | ||||
| -rw-r--r-- | src/analyze.cpp | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/BRANCH_TODO b/BRANCH_TODO index c80c1e92e4..bd797a75a8 100644 --- a/BRANCH_TODO +++ b/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 diff --git a/src/analyze.cpp b/src/analyze.cpp index cf71bd90f3..aa5c3c88f7 100644 --- a/src/analyze.cpp +++ b/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) { |
