Using ForArrayRemovable
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
#include "core/defer.hpp"
|
||||||
#define ARRAY_ALLOCATOR_TYPE Allocator
|
#define ARRAY_ALLOCATOR_TYPE Allocator
|
||||||
#define ARRAY_ASSERT assert
|
#define ARRAY_ASSERT assert
|
||||||
#define ARRAY_ALLOCATE(allocator, size) allocate_size(allocator, size)
|
#define ARRAY_ALLOCATE(allocator, size) allocate_size(allocator, size)
|
||||||
|
|||||||
@@ -354,11 +354,10 @@ 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);
|
||||||
for (int i = 0; i < result->lambda->args.len; i += 1) {
|
ForArrayRemovable(result->lambda->args) {
|
||||||
auto &it = result->lambda->args[i];
|
ForArrayRemovablePrepare(result->lambda->args);
|
||||||
if (it->flags & AST_IDENT_POLYMORPH) {
|
if (it->flags & AST_IDENT_POLYMORPH) {
|
||||||
result->lambda->args.ordered_remove(it);
|
ForArrayRemovableDeclare();
|
||||||
i -= 1; // @verify: Need to pay attention if this is correct
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1696,12 +1696,12 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str
|
|||||||
// Find the polymorph
|
// Find the polymorph
|
||||||
if (lambda->flags & AST_POLYMORPH) {
|
if (lambda->flags & AST_POLYMORPH) {
|
||||||
Array<Ast_Call_Item *> replacements = {scratch.arena};
|
Array<Ast_Call_Item *> replacements = {scratch.arena};
|
||||||
for (int i = 0; i < matches.len; i += 1) {
|
ForArrayRemovable(matches) {
|
||||||
Match &it = matches[i];
|
ForArrayRemovablePrepare(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); // @verify: Need to pay attention if this is correct
|
ForArrayRemovableDeclare();
|
||||||
i -= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user