This commit is contained in:
Krzosa Karol
2023-04-02 12:36:02 +02:00
parent 18c0af2b99
commit f8e78c8ee4

View File

@@ -260,6 +260,7 @@ Ast *ast_copy(Ast *ast, Ast_Scope *parent_scope, Array<Ast_Decl *> *replace, Arr
dst->args.init(pctx->perm, src->args.len);
For(src->args) {
if (it->flags & AST_POLYMORPH) continue;
auto copy = (Ast_Decl *)ast_copy(it, parent_scope, replace, with);
dst->args.add(copy);
}
@@ -276,7 +277,9 @@ Ast *ast_copy(Ast *ast, Ast_Scope *parent_scope, Array<Ast_Decl *> *replace, Arr
default: assert(!"Invalid default case");
}
assert(result);
unset_flag(result->flags, AST_POLYMORPH | AST_PARENT_POLYMORPH);
return result;
}
@@ -355,13 +358,6 @@ Ast_Decl *get_or_instantiate_polymorph_lambda(Token *pos, Ast_Decl *poly, Array<
if (!result) {
result = (Ast_Decl *)ast_copy(poly, poly->parent_scope, &poly->polymorph_parameters, &params);
ForArrayRemovable(result->lambda->args) {
ForArrayRemovablePrepare(result->lambda->args);
if (it->flags & AST_IDENT_POLYMORPH) {
ForArrayRemovableDeclare();
}
}
result->polymorph_hash = hash;
assert(result->di != poly->di);