Fix matches list

This commit is contained in:
Krzosa Karol
2023-04-01 20:36:36 +02:00
parent 96ce6765fe
commit 3c70b45be4
2 changed files with 9 additions and 3 deletions

View File

@@ -356,7 +356,7 @@ Ast_Decl *get_or_instantiate_polymorph_lambda(Token *pos, Ast_Decl *poly, Array<
result = (Ast_Decl *)ast_copy(poly, poly->parent_scope, &poly->polymorph_parameters, &params); result = (Ast_Decl *)ast_copy(poly, poly->parent_scope, &poly->polymorph_parameters, &params);
For(result->lambda->args) { For(result->lambda->args) {
if (it->flags & AST_IDENT_POLYMORPH) { if (it->flags & AST_IDENT_POLYMORPH) {
result->lambda->args.ordered_remove(it); result->lambda->args.ordered_remove(it); //@verify: this does not fuck ordereding
} }
} }

View File

@@ -1699,7 +1699,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str
For(matches) { For(matches) {
if (it.lambda_arg->flags & AST_POLYMORPH) { if (it.lambda_arg->flags & AST_POLYMORPH) {
replacements.add(it.call_arg); replacements.add(it.call_arg);
matches.ordered_remove(it); matches.ordered_remove(it); //@verify: this does not fuck ordereding
} }
} }
@@ -1710,7 +1710,13 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str
// We know need to fix the matches list CAUSE ITS FUCKED // We know need to fix the matches list CAUSE ITS FUCKED
// Thanks polymorphism // Thanks polymorphism
For(matches) { For_Named(matches, match_it) {
For_Named(lambda->args, lambda_it) {
if (match_it.lambda_arg->name == lambda_it->name) {
match_it.lambda_arg = lambda_it;
break;
}
}
} }
} }