zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 8be95af48011f71f1902dff4ffbf5ea95cf1bcf4 (tree)
parent 8d4cb852856631543aa961a6149b9a22021a1573
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Thu,  8 Aug 2019 13:07:05 -0400

add compile error for unable to determine async fn frame

Diffstat:
MBRANCH_TODO | 5+++++
Msrc/analyze.cpp | 7+++++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git 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 @@ -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) {