| ... | @@ -3186,7 +3186,11 @@ static IrInstruction *ir_gen_return(IrBuilder *irb, Scope *scope, AstNode *node, | ... | @@ -3186,7 +3186,11 @@ static IrInstruction *ir_gen_return(IrBuilder *irb, Scope *scope, AstNode *node, |
| 3186 | { | 3186 | { |
| 3187 | IrInstruction *return_value; | 3187 | IrInstruction *return_value; |
| 3188 | if (expr_node) { | 3188 | if (expr_node) { |
| | 3189 | // Temporarily set this so that if we return a type it gets the name of the function |
| | 3190 | FnTableEntry *prev_name_fn = irb->exec->name_fn; |
| | 3191 | irb->exec->name_fn = exec_fn_entry(irb->exec); |
| 3189 | return_value = ir_gen_node(irb, expr_node, scope); | 3192 | return_value = ir_gen_node(irb, expr_node, scope); |
| | 3193 | irb->exec->name_fn = prev_name_fn; |
| 3190 | if (return_value == irb->codegen->invalid_instruction) | 3194 | if (return_value == irb->codegen->invalid_instruction) |
| 3191 | return irb->codegen->invalid_instruction; | 3195 | return irb->codegen->invalid_instruction; |
| 3192 | } else { | 3196 | } else { |
| ... | @@ -6481,20 +6485,17 @@ static bool render_instance_name_recursive(CodeGen *codegen, Buf *name, Scope *o | ... | @@ -6481,20 +6485,17 @@ static bool render_instance_name_recursive(CodeGen *codegen, Buf *name, Scope *o |
| 6481 | static Buf *get_anon_type_name(CodeGen *codegen, IrExecutable *exec, const char *kind_name, AstNode *source_node) { | 6485 | static Buf *get_anon_type_name(CodeGen *codegen, IrExecutable *exec, const char *kind_name, AstNode *source_node) { |
| 6482 | if (exec->name) { | 6486 | if (exec->name) { |
| 6483 | return exec->name; | 6487 | return exec->name; |
| | 6488 | } else if (exec->name_fn != nullptr) { |
| | 6489 | Buf *name = buf_alloc(); |
| | 6490 | buf_append_buf(name, &exec->name_fn->symbol_name); |
| | 6491 | buf_appendf(name, "("); |
| | 6492 | render_instance_name_recursive(codegen, name, &exec->name_fn->fndef_scope->base, exec->begin_scope); |
| | 6493 | buf_appendf(name, ")"); |
| | 6494 | return name; |
| 6484 | } else { | 6495 | } else { |
| 6485 | FnTableEntry *fn_entry = exec_fn_entry(exec); | 6496 | //Note: C-imports do not have valid location information |
| 6486 | if (fn_entry) { | 6497 | return buf_sprintf("(anonymous %s at %s:%" ZIG_PRI_usize ":%" ZIG_PRI_usize ")", kind_name, |
| 6487 | Buf *name = buf_alloc(); | 6498 | (source_node->owner->path != nullptr) ? buf_ptr(source_node->owner->path) : "(null)", source_node->line + 1, source_node->column + 1); |
| 6488 | buf_append_buf(name, &fn_entry->symbol_name); | | |
| 6489 | buf_appendf(name, "("); | | |
| 6490 | render_instance_name_recursive(codegen, name, &fn_entry->fndef_scope->base, exec->begin_scope); | | |
| 6491 | buf_appendf(name, ")"); | | |
| 6492 | return name; | | |
| 6493 | } else { | | |
| 6494 | //Note: C-imports do not have valid location information | | |
| 6495 | return buf_sprintf("(anonymous %s at %s:%" ZIG_PRI_usize ":%" ZIG_PRI_usize ")", kind_name, | | |
| 6496 | (source_node->owner->path != nullptr) ? buf_ptr(source_node->owner->path) : "(null)", source_node->line + 1, source_node->column + 1); | | |
| 6497 | } | | |
| 6498 | } | 6499 | } |
| 6499 | } | 6500 | } |
| 6500 | | 6501 | |