| ... | ... | @@ -271,6 +271,7 @@ static IrInstGen *ir_analyze_inferred_field_ptr(IrAnalyze *ira, Buf *field_name, |
| 271 | 271 | IrInst* source_instr, IrInstGen *container_ptr, ZigType *container_type); |
| 272 | 272 | static ResultLoc *no_result_loc(void); |
| 273 | 273 | static IrInstGen *ir_analyze_test_non_null(IrAnalyze *ira, IrInst *source_inst, IrInstGen *value); |
| 274 | static IrInstGen *ir_error_dependency_loop(IrAnalyze *ira, IrInst *source_instr); |
| 274 | 275 | |
| 275 | 276 | static void destroy_instruction_src(IrInstSrc *inst) { |
| 276 | 277 | #ifdef ZIG_ENABLE_MEM_PROFILE |
| ... | ... | @@ -20999,8 +21000,13 @@ static IrInstGen *ir_analyze_container_member_access_inner(IrAnalyze *ira, |
| 20999 | 21000 | resolve_top_level_decl(ira->codegen, tld, source_instr->source_node, false); |
| 21000 | 21001 | if (tld->resolution == TldResolutionInvalid) |
| 21001 | 21002 | return ira->codegen->invalid_inst_gen; |
| 21003 | if (tld->resolution == TldResolutionResolving) |
| 21004 | return ir_error_dependency_loop(ira, source_instr); |
| 21005 | |
| 21002 | 21006 | TldFn *tld_fn = (TldFn *)tld; |
| 21003 | 21007 | ZigFn *fn_entry = tld_fn->fn_entry; |
| 21008 | assert(fn_entry != nullptr); |
| 21009 | |
| 21004 | 21010 | if (type_is_invalid(fn_entry->type_entry)) |
| 21005 | 21011 | return ira->codegen->invalid_inst_gen; |
| 21006 | 21012 | |
| ... | ... | @@ -21010,8 +21016,13 @@ static IrInstGen *ir_analyze_container_member_access_inner(IrAnalyze *ira, |
| 21010 | 21016 | resolve_top_level_decl(ira->codegen, tld, source_instr->source_node, false); |
| 21011 | 21017 | if (tld->resolution == TldResolutionInvalid) |
| 21012 | 21018 | return ira->codegen->invalid_inst_gen; |
| 21019 | if (tld->resolution == TldResolutionResolving) |
| 21020 | return ir_error_dependency_loop(ira, source_instr); |
| 21021 | |
| 21013 | 21022 | TldVar *tld_var = (TldVar *)tld; |
| 21014 | 21023 | ZigVar *var = tld_var->var; |
| 21024 | assert(var != nullptr); |
| 21025 | |
| 21015 | 21026 | if (type_is_invalid(var->var_type)) |
| 21016 | 21027 | return ira->codegen->invalid_inst_gen; |
| 21017 | 21028 | |
| ... | ... | @@ -21334,6 +21345,8 @@ static IrInstGen *ir_analyze_decl_ref(IrAnalyze *ira, IrInst* source_instruction |
| 21334 | 21345 | if (tld->resolution == TldResolutionInvalid) { |
| 21335 | 21346 | return ira->codegen->invalid_inst_gen; |
| 21336 | 21347 | } |
| 21348 | if (tld->resolution == TldResolutionResolving) |
| 21349 | return ir_error_dependency_loop(ira, source_instruction); |
| 21337 | 21350 | |
| 21338 | 21351 | switch (tld->id) { |
| 21339 | 21352 | case TldIdContainer: |
| ... | ... | @@ -21343,9 +21356,8 @@ static IrInstGen *ir_analyze_decl_ref(IrAnalyze *ira, IrInst* source_instruction |
| 21343 | 21356 | case TldIdVar: { |
| 21344 | 21357 | TldVar *tld_var = (TldVar *)tld; |
| 21345 | 21358 | ZigVar *var = tld_var->var; |
| 21346 | | if (var == nullptr) { |
| 21347 | | return ir_error_dependency_loop(ira, source_instruction); |
| 21348 | | } |
| 21359 | assert(var != nullptr); |
| 21360 | |
| 21349 | 21361 | if (tld_var->extern_lib_name != nullptr) { |
| 21350 | 21362 | add_link_lib_symbol(ira, tld_var->extern_lib_name, buf_create_from_str(var->name), |
| 21351 | 21363 | source_instruction->source_node); |
| ... | ... | @@ -21356,7 +21368,7 @@ static IrInstGen *ir_analyze_decl_ref(IrAnalyze *ira, IrInst* source_instruction |
| 21356 | 21368 | case TldIdFn: { |
| 21357 | 21369 | TldFn *tld_fn = (TldFn *)tld; |
| 21358 | 21370 | ZigFn *fn_entry = tld_fn->fn_entry; |
| 21359 | | assert(fn_entry->type_entry); |
| 21371 | assert(fn_entry->type_entry != nullptr); |
| 21360 | 21372 | |
| 21361 | 21373 | if (type_is_invalid(fn_entry->type_entry)) |
| 21362 | 21374 | return ira->codegen->invalid_inst_gen; |
| ... | ... | @@ -23536,11 +23548,14 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23536 | 23548 | |
| 23537 | 23549 | while ((curr_entry = decl_it.next()) != nullptr) { |
| 23538 | 23550 | // If the declaration is unresolved, force it to be resolved again. |
| 23539 | | if (curr_entry->value->resolution == TldResolutionUnresolved) { |
| 23540 | | resolve_top_level_decl(ira->codegen, curr_entry->value, curr_entry->value->source_node, false); |
| 23541 | | if (curr_entry->value->resolution != TldResolutionOk) { |
| 23542 | | return ErrorSemanticAnalyzeFail; |
| 23543 | | } |
| 23551 | resolve_top_level_decl(ira->codegen, curr_entry->value, curr_entry->value->source_node, false); |
| 23552 | if (curr_entry->value->resolution == TldResolutionInvalid) { |
| 23553 | return ErrorSemanticAnalyzeFail; |
| 23554 | } |
| 23555 | |
| 23556 | if (curr_entry->value->resolution == TldResolutionResolving) { |
| 23557 | ir_error_dependency_loop(ira, source_instr); |
| 23558 | return ErrorSemanticAnalyzeFail; |
| 23544 | 23559 | } |
| 23545 | 23560 | |
| 23546 | 23561 | // Skip comptime blocks and test functions. |
| ... | ... | @@ -23597,6 +23612,8 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23597 | 23612 | case TldIdVar: |
| 23598 | 23613 | { |
| 23599 | 23614 | ZigVar *var = ((TldVar *)curr_entry->value)->var; |
| 23615 | assert(var != nullptr); |
| 23616 | |
| 23600 | 23617 | if ((err = type_resolve(ira->codegen, var->const_value->type, ResolveStatusSizeKnown))) |
| 23601 | 23618 | return ErrorSemanticAnalyzeFail; |
| 23602 | 23619 | |
| ... | ... | @@ -23627,11 +23644,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23627 | 23644 | |
| 23628 | 23645 | ZigFn *fn_entry = ((TldFn *)curr_entry->value)->fn_entry; |
| 23629 | 23646 | assert(!fn_entry->is_test); |
| 23630 | | |
| 23631 | | if (fn_entry->type_entry == nullptr) { |
| 23632 | | ir_error_dependency_loop(ira, source_instr); |
| 23633 | | return ErrorSemanticAnalyzeFail; |
| 23634 | | } |
| 23647 | assert(fn_entry->type_entry != nullptr); |
| 23635 | 23648 | |
| 23636 | 23649 | AstNodeFnProto *fn_node = &fn_entry->proto_node->data.fn_proto; |
| 23637 | 23650 | |