Add resolved_type to Ast_Expr and remove from inheriting
This commit is contained in:
17
ast.cpp
17
ast.cpp
@@ -66,6 +66,11 @@ struct Ast{
|
||||
|
||||
struct Ast_Type;
|
||||
struct Ast_Expr:Ast{
|
||||
union{
|
||||
Ast_Type *resolved_type;
|
||||
Ast_Type *index_original_type;
|
||||
Ast_Type *cast_after_type;
|
||||
};
|
||||
};
|
||||
|
||||
#define VALUE_FIELDS \
|
||||
@@ -79,7 +84,6 @@ union{ \
|
||||
};
|
||||
#define INLINE_VALUE_FIELDS union{Value value; struct{VALUE_FIELDS};}
|
||||
struct Value{VALUE_FIELDS};
|
||||
// BigInt big_int_val;
|
||||
|
||||
struct Ast_Atom: Ast_Expr{
|
||||
Ast_Decl *resolved_decl;
|
||||
@@ -98,20 +102,17 @@ struct Ast_Call: Ast_Expr{
|
||||
Ast_Expr *typespec;
|
||||
};
|
||||
Array<Ast_Call_Item *> exprs;
|
||||
Ast_Type *type;
|
||||
};
|
||||
|
||||
struct Ast_Unary: Ast_Expr{
|
||||
Token_Kind op;
|
||||
Ast_Expr *expr;
|
||||
Ast_Type *type;
|
||||
U64 padding[2]; // For folding constants into atoms
|
||||
};
|
||||
|
||||
struct Ast_Index: Ast_Expr{
|
||||
Ast_Expr *expr;
|
||||
Ast_Expr *index;
|
||||
Ast_Type *original_type;
|
||||
};
|
||||
|
||||
struct Ast_Binary: Ast_Expr{
|
||||
@@ -119,10 +120,14 @@ struct Ast_Binary: Ast_Expr{
|
||||
Ast_Expr *left;
|
||||
Ast_Expr *right;
|
||||
|
||||
Ast_Type *type;
|
||||
// Ast_Type *type; // For casts after_type
|
||||
Ast_Type *before_type;
|
||||
};
|
||||
|
||||
struct Ast_Len: Ast_Expr{
|
||||
Ast_Expr *expr;
|
||||
};
|
||||
|
||||
// Problem: We are parsing out of order, in the middle of parsing a function
|
||||
// we can jump down a different function, we cant therfore use global map.
|
||||
// Each scope needs to have it's checked locals list. To lookup syms we need to
|
||||
@@ -156,13 +161,11 @@ struct Ast_Lambda : Ast_Expr {
|
||||
Array<Ast_Decl *> args;
|
||||
Ast_Expr *ret;
|
||||
Ast_Scope *scope;
|
||||
Ast_Type *type;
|
||||
};
|
||||
|
||||
struct Ast_Array: Ast_Expr{
|
||||
Ast_Expr *base;
|
||||
Ast_Expr *expr;
|
||||
Ast_Type *type;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user