Factor
This commit is contained in:
@@ -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);
|
dst->args.init(pctx->perm, src->args.len);
|
||||||
For(src->args) {
|
For(src->args) {
|
||||||
|
if (it->flags & AST_POLYMORPH) continue;
|
||||||
auto copy = (Ast_Decl *)ast_copy(it, parent_scope, replace, with);
|
auto copy = (Ast_Decl *)ast_copy(it, parent_scope, replace, with);
|
||||||
dst->args.add(copy);
|
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");
|
default: assert(!"Invalid default case");
|
||||||
}
|
}
|
||||||
assert(result);
|
assert(result);
|
||||||
|
|
||||||
unset_flag(result->flags, AST_POLYMORPH | AST_PARENT_POLYMORPH);
|
unset_flag(result->flags, AST_POLYMORPH | AST_PARENT_POLYMORPH);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,13 +358,6 @@ Ast_Decl *get_or_instantiate_polymorph_lambda(Token *pos, Ast_Decl *poly, Array<
|
|||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
result = (Ast_Decl *)ast_copy(poly, poly->parent_scope, &poly->polymorph_parameters, ¶ms);
|
result = (Ast_Decl *)ast_copy(poly, poly->parent_scope, &poly->polymorph_parameters, ¶ms);
|
||||||
ForArrayRemovable(result->lambda->args) {
|
|
||||||
ForArrayRemovablePrepare(result->lambda->args);
|
|
||||||
if (it->flags & AST_IDENT_POLYMORPH) {
|
|
||||||
ForArrayRemovableDeclare();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result->polymorph_hash = hash;
|
result->polymorph_hash = hash;
|
||||||
|
|
||||||
assert(result->di != poly->di);
|
assert(result->di != poly->di);
|
||||||
|
|||||||
Reference in New Issue
Block a user