For from pointer to reference

This commit is contained in:
Krzosa Karol
2022-05-30 13:34:04 +02:00
parent 3a97e739a8
commit 55fd4ca40c
6 changed files with 86 additions and 80 deletions

View File

@@ -291,7 +291,7 @@ ast_call(Token *pos, Ast_Expr *name, Array<Ast_Call_Item *> exprs){
result->name = name;
result->exprs = exprs.tight_copy(pctx->perm);
if(result->name) result->name->parent = result;
For(result->exprs) it[0]->parent = result;
For(result->exprs) it->parent = result;
return result;
}
@@ -350,7 +350,7 @@ ast_lambda(Token *pos, Array<Ast_Lambda_Arg *> params, Ast_Expr *ret, Ast_Block
if(result->block) result->block->parent = result;
result->ret->parent = result;
For(result->args) it[0]->parent = result;
For(result->args) it->parent = result;
return result;
}
@@ -370,7 +370,7 @@ function Ast_Block *
ast_block(Token *pos, Array<Ast *> stmts){
AST_NEW(Block, BLOCK, pos, AST_STMT);
result->stmts = stmts.tight_copy(pctx->perm);
For(result->stmts) it[0]->parent = result;
For(result->stmts) it->parent = result;
return result;
}
@@ -378,7 +378,7 @@ function Ast_If *
ast_if(Token *pos, Array<Ast_If_Node *> ifs){
AST_NEW(If, IF, pos, AST_STMT);
result->ifs = ifs.tight_copy(pctx->perm);
For(result->ifs) it[0]->parent = result;
For(result->ifs) it->parent = result;
return result;
}
@@ -430,9 +430,9 @@ ast_struct(Token *pos, Array<Ast_Named *> members){
AST_NEW(Struct, STRUCT, pos, AST_AGGREGATE);
result->members = members.tight_copy(pctx->perm);
For(result->members) {
assert(is_flag_set(it[0]->flags, AST_BINDING));
assert(it[0]->kind == AST_VAR || it[0]->kind == AST_CONST);
it[0]->parent = result;
assert(is_flag_set(it->flags, AST_BINDING));
assert(it->kind == AST_VAR || it->kind == AST_CONST);
it->parent = result;
}
return result;
}
@@ -468,7 +468,7 @@ ast_package(Token *pos, String name, Array<Ast_Named *> decls){
result->decls = decls.tight_copy(pctx->perm);
result->ordered = array_make<Ast_Named *>(pctx->perm, decls.len);
result->name = intern_string(&pctx->interns, name);
For(result->decls) it[0]->parent = result;
For(result->decls) it->parent = result;
return result;
}