New cast '->'

This commit is contained in:
Krzosa Karol
2022-06-13 15:38:54 +02:00
parent 2503a6d680
commit f9487a2c24
6 changed files with 22 additions and 46 deletions

17
ast.cpp
View File

@@ -111,13 +111,6 @@ struct Ast_Load: Ast{
String string;
};
struct Ast_Cast: Ast_Expr{
Ast_Expr *expr;
Ast_Expr *typespec;
Ast_Type *before_type;
Ast_Type *after_type;
};
struct Ast_Index: Ast_Expr{
Ast_Expr *expr;
Ast_Expr *index;
@@ -130,6 +123,7 @@ struct Ast_Binary: Ast_Expr{
Ast_Expr *right;
Ast_Type *type;
Ast_Type *before_type;
};
// Problem: We are parsing out of order, in the middle of parsing a function
@@ -314,15 +308,6 @@ ast_call_item(Token *pos, Ast_Atom *name, Ast_Expr *index, Ast_Expr *item){
return result;
}
function Ast_Expr *
ast_expr_cast(Token *pos, Ast_Expr *expr, Ast_Expr *typespec){
AST_NEW(Cast, CAST, pos, AST_EXPR);
result->flags = AST_EXPR;
result->expr = expr;
result->typespec = typespec;
return result;
}
function Ast_Expr *
ast_expr_unary(Token *pos, Token_Kind op, Ast_Expr *expr){
AST_NEW(Unary, UNARY, pos, AST_EXPR);