From 856198b2ea473a4fd2cd020e58db821265b21ca5 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Tue, 20 Jan 2026 10:33:17 +0000 Subject: Move semantics... --- src/parser/parser_utils.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/parser/parser_utils.c') diff --git a/src/parser/parser_utils.c b/src/parser/parser_utils.c index f96ed24..4973111 100644 --- a/src/parser/parser_utils.c +++ b/src/parser/parser_utils.c @@ -1520,7 +1520,8 @@ ASTNode *copy_ast_replacing(ASTNode *n, const char *p, const char *c, const char break; case NODE_IMPL_TRAIT: new_node->impl_trait.trait_name = xstrdup(n->impl_trait.trait_name); - new_node->impl_trait.target_type = replace_type_str(n->impl_trait.target_type, p, c, os, ns); + new_node->impl_trait.target_type = + replace_type_str(n->impl_trait.target_type, p, c, os, ns); new_node->impl_trait.methods = copy_ast_replacing(n->impl_trait.methods, p, c, os, ns); break; default: @@ -1884,13 +1885,15 @@ void instantiate_methods(ParserContext *ctx, GenericImplTemplate *it, it->struct_name, mangled_struct_name); it->impl_node->next = backup_next; // Restore - ASTNode *meth = NULL; - if (new_impl->type == NODE_IMPL) { + if (new_impl->type == NODE_IMPL) + { new_impl->impl.struct_name = xstrdup(mangled_struct_name); meth = new_impl->impl.methods; - } else if (new_impl->type == NODE_IMPL_TRAIT) { + } + else if (new_impl->type == NODE_IMPL_TRAIT) + { new_impl->impl_trait.target_type = xstrdup(mangled_struct_name); meth = new_impl->impl_trait.methods; } @@ -2009,7 +2012,7 @@ void instantiate_generic(ParserContext *ctx, const char *tpl, const char *arg, ASTNode *i = ast_create(NODE_STRUCT); i->strct.name = xstrdup(m); i->strct.is_template = 0; - + // Copy type attributes (e.g. has_drop) i->type_info = type_new(TYPE_STRUCT); i->type_info->name = xstrdup(m); @@ -2033,7 +2036,7 @@ void instantiate_generic(ParserContext *ctx, const char *tpl, const char *arg, ASTNode *i = ast_create(NODE_ENUM); i->enm.name = xstrdup(m); i->enm.is_template = 0; - + // Copy type attributes (e.g. has_drop) i->type_info = type_new(TYPE_ENUM); i->type_info->name = xstrdup(m); -- cgit v1.2.3