}
}
- 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.");