Ast_Init is not Ast_Binary with TK_Comma

This commit is contained in:
Krzosa Karol
2022-05-31 16:24:04 +02:00
parent 7dfc4c7b36
commit 41697dec80
6 changed files with 29 additions and 41 deletions

View File

@@ -178,16 +178,10 @@ struct Ast_Return: Ast{
Ast_Expr *expr;
};
struct Ast_Init: Ast{
Token_Kind op;
Ast_Atom *ident;
Ast_Expr *expr;
};
struct Ast_If_Node: Ast{
Ast_Expr *expr ;
Ast_Block *block;
Ast_Init *init;
Ast_Binary*init;
};
struct Ast_If: Ast{
@@ -405,7 +399,7 @@ ast_return(Token *pos, Ast_Expr *expr){
}
function Ast_If_Node *
ast_if_node(Token *pos, Ast_Init *init, Ast_Expr *expr, Ast_Block *block){
ast_if_node(Token *pos, Ast_Binary *init, Ast_Expr *expr, Ast_Block *block){
AST_NEW(If_Node, IF_NODE, pos, AST_STMT);
result->block = block;
result->expr = expr;
@@ -416,17 +410,6 @@ ast_if_node(Token *pos, Ast_Init *init, Ast_Expr *expr, Ast_Block *block){
return result;
}
function Ast_Init *
ast_init(Token *pos, Token_Kind op, Ast_Atom *ident, Ast_Expr *expr){
AST_NEW(Init, INIT, pos, AST_STMT);
result->op = op;
result->ident = ident;
result->expr = expr;
result->ident->parent = result;
result->expr->parent = result;
return result;
}
function Ast_Array *
ast_array(Token *pos, Ast_Expr *expr){
AST_NEW(Array, ARRAY, pos, AST_EXPR);