| ... | @@ -4172,13 +4172,16 @@ IrInstruction *ir_gen_fn(CodeGen *codegen, FnTableEntry *fn_entry) { | ... | @@ -4172,13 +4172,16 @@ IrInstruction *ir_gen_fn(CodeGen *codegen, FnTableEntry *fn_entry) { |
| 4172 | static void add_call_stack_errors(CodeGen *codegen, IrExecutable *exec, ErrorMsg *err_msg, int limit) { | 4172 | static void add_call_stack_errors(CodeGen *codegen, IrExecutable *exec, ErrorMsg *err_msg, int limit) { |
| 4173 | if (!exec || !exec->source_node || limit < 0) return; | 4173 | if (!exec || !exec->source_node || limit < 0) return; |
| 4174 | add_error_note(codegen, err_msg, exec->source_node, buf_sprintf("called from here")); | 4174 | add_error_note(codegen, err_msg, exec->source_node, buf_sprintf("called from here")); |
| | 4175 | |
| 4175 | add_call_stack_errors(codegen, exec->parent_exec, err_msg, limit - 1); | 4176 | add_call_stack_errors(codegen, exec->parent_exec, err_msg, limit - 1); |
| 4176 | } | 4177 | } |
| 4177 | | 4178 | |
| 4178 | static ErrorMsg *ir_add_error(IrAnalyze *ira, IrInstruction *source_instruction, Buf *msg) { | 4179 | static ErrorMsg *ir_add_error(IrAnalyze *ira, IrInstruction *source_instruction, Buf *msg) { |
| 4179 | ira->new_irb.exec->invalid = true; | 4180 | ira->new_irb.exec->invalid = true; |
| 4180 | ErrorMsg *err_msg = add_node_error(ira->codegen, source_instruction->source_node, msg); | 4181 | ErrorMsg *err_msg = add_node_error(ira->codegen, source_instruction->source_node, msg); |
| 4181 | add_call_stack_errors(ira->codegen, ira->new_irb.exec, err_msg, 10); | 4182 | if (ira->new_irb.exec->parent_exec) { |
| | 4183 | add_call_stack_errors(ira->codegen, ira->new_irb.exec, err_msg, 10); |
| | 4184 | } |
| 4182 | return err_msg; | 4185 | return err_msg; |
| 4183 | } | 4186 | } |
| 4184 | | 4187 | |
| ... | @@ -6243,6 +6246,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal | ... | @@ -6243,6 +6246,11 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 6243 | if (impl_fn->type_entry->id == TypeTableEntryIdInvalid) | 6246 | if (impl_fn->type_entry->id == TypeTableEntryIdInvalid) |
| 6244 | return ira->codegen->builtin_types.entry_invalid; | 6247 | return ira->codegen->builtin_types.entry_invalid; |
| 6245 | | 6248 | |
| | 6249 | impl_fn->ir_executable.source_node = call_instruction->base.source_node; |
| | 6250 | impl_fn->ir_executable.parent_exec = ira->new_irb.exec; |
| | 6251 | impl_fn->analyzed_executable.source_node = call_instruction->base.source_node; |
| | 6252 | impl_fn->analyzed_executable.parent_exec = ira->new_irb.exec; |
| | 6253 | |
| 6246 | ira->codegen->fn_protos.append(impl_fn); | 6254 | ira->codegen->fn_protos.append(impl_fn); |
| 6247 | ira->codegen->fn_defs.append(impl_fn); | 6255 | ira->codegen->fn_defs.append(impl_fn); |
| 6248 | } | 6256 | } |