From: Brendan Hansen Date: Fri, 21 Apr 2023 18:34:34 +0000 (-0500) Subject: Merge branch 'dev' into feature/closures X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=94b532b3ac662dc93e595850e093a36e3e3c429c;p=onyx.git Merge branch 'dev' into feature/closures --- 94b532b3ac662dc93e595850e093a36e3e3c429c diff --cc compiler/src/checker.c index 217e3788,2515038a..6f6c277f --- a/compiler/src/checker.c +++ b/compiler/src/checker.c @@@ -2572,22 -2531,14 +2561,22 @@@ CheckStatus check_function(AstFunction } } - bh_arr_clear(expected_return_type_stack); - bh_arr_push(expected_return_type_stack, &func->type->Function.return_type); + bh_arr_clear(context.checker.expected_return_type_stack); + bh_arr_push(context.checker.expected_return_type_stack, &func->type->Function.return_type); - inside_for_iterator = 0; - if (for_node_stack) bh_arr_clear(for_node_stack); + context.checker.inside_for_iterator = 0; + if (context.checker.for_node_stack) bh_arr_clear(context.checker.for_node_stack); if (func->body) { - CheckStatus status = check_block(func->body); + CheckStatus status = Check_Success; + if (func->captures) { + status = check_capture_block(func->captures); + } + + if (status == Check_Success) { + status = check_block(func->body); + } + if (status == Check_Error && func->generated_from && context.cycle_detected == 0) ERROR(func->generated_from->pos, "Error in polymorphic procedure generated from this location.");