We are generating basic polymorphic types!
This commit is contained in:
@@ -41,8 +41,13 @@ Ast *ast_copy(Ast *ast, Ast_Scope *parent_scope, Array<Ast_Decl *> *replace, Arr
|
||||
|
||||
if ((dst->flags & AST_TYPESPEC)) {
|
||||
For(*replace) {
|
||||
assert(it->type == pctx->type_type);
|
||||
if (it->name == dst->intern_val) {
|
||||
Breakpoint;
|
||||
int it_index = replace->get_index(&it);
|
||||
Ast_Call_Item *replacement = with[0][it_index];
|
||||
Ast_Atom *replacement_v = (Ast_Atom *)replacement->item;
|
||||
assert(replacement_v->resolved_type == pctx->type_type);
|
||||
dst = ast_create_copy(parent_scope, Ast_Atom, replacement_v);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,6 +294,9 @@ Ast_Decl *get_or_instantiate_polymorph_type(Token *pos, Ast_Decl *poly, Array<As
|
||||
|
||||
if (!result) {
|
||||
result = (Ast_Decl *)ast_copy(poly, poly->parent_scope, &poly->polymorph_parameters, ¶ms);
|
||||
unset_flag(result->flags, AST_POLYMORPH);
|
||||
result->type_val = type_incomplete(result);
|
||||
result->polymorph_hash = hash;
|
||||
poly->polymorphs.add(result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user