Compound arrays
This commit is contained in:
26
ast.cpp
26
ast.cpp
@@ -60,17 +60,17 @@ struct Ast{
|
||||
Ast_Flag flags;
|
||||
};
|
||||
|
||||
struct Ast_Resolved_Type;
|
||||
struct Ast_Type;
|
||||
struct Ast_Expr:Ast{ };
|
||||
|
||||
#define VALUE_FIELDS \
|
||||
Ast_Resolved_Type *type; \
|
||||
Ast_Type *type; \
|
||||
union{ \
|
||||
bool bool_val; \
|
||||
F64 f64_val; \
|
||||
Intern_String intern_val; \
|
||||
BigInt big_int_val;\
|
||||
Ast_Resolved_Type *type_val; \
|
||||
Ast_Type *type_val; \
|
||||
};
|
||||
#define INLINE_VALUE_FIELDS union{Value value; struct{VALUE_FIELDS};}
|
||||
struct Value{VALUE_FIELDS};
|
||||
@@ -82,7 +82,7 @@ struct Ast_Atom: Ast_Expr{
|
||||
};
|
||||
|
||||
struct Ast_Call_Item: Ast_Expr{
|
||||
Ast_Atom *name;
|
||||
Ast_Atom *name; // for calls only name, for compounds name | index
|
||||
Ast_Expr *item;
|
||||
Ast_Expr *index;
|
||||
};
|
||||
@@ -93,27 +93,27 @@ struct Ast_Call: Ast_Expr{
|
||||
Ast_Expr *typespec;
|
||||
};
|
||||
Array<Ast_Call_Item *> exprs;
|
||||
Ast_Resolved_Type *type;
|
||||
Ast_Type *type;
|
||||
};
|
||||
|
||||
struct Ast_Unary: Ast_Expr{
|
||||
Token_Kind op;
|
||||
Ast_Expr *expr;
|
||||
Ast_Resolved_Type *type;
|
||||
Ast_Type *type;
|
||||
U64 padding[2]; // For folding constants into atoms
|
||||
};
|
||||
|
||||
struct Ast_Cast: Ast_Expr{
|
||||
Ast_Expr *expr;
|
||||
Ast_Expr *typespec;
|
||||
Ast_Resolved_Type *before_type;
|
||||
Ast_Resolved_Type *after_type;
|
||||
Ast_Type *before_type;
|
||||
Ast_Type *after_type;
|
||||
};
|
||||
|
||||
struct Ast_Index: Ast_Expr{
|
||||
Ast_Expr *expr;
|
||||
Ast_Expr *index;
|
||||
Ast_Resolved_Type *original_type;
|
||||
Ast_Type *original_type;
|
||||
};
|
||||
|
||||
struct Ast_Binary: Ast_Expr{
|
||||
@@ -121,7 +121,7 @@ struct Ast_Binary: Ast_Expr{
|
||||
Ast_Expr *left;
|
||||
Ast_Expr *right;
|
||||
|
||||
Ast_Resolved_Type *type;
|
||||
Ast_Type *type;
|
||||
};
|
||||
|
||||
// Problem: We are parsing out of order, in the middle of parsing a function
|
||||
@@ -157,13 +157,13 @@ struct Ast_Lambda : Ast_Expr {
|
||||
Array<Ast_Decl *> args;
|
||||
Ast_Expr *ret;
|
||||
Ast_Scope *scope;
|
||||
Ast_Resolved_Type *type;
|
||||
Ast_Type *type;
|
||||
};
|
||||
|
||||
struct Ast_Array: Ast_Expr{
|
||||
Ast_Expr *base;
|
||||
Ast_Expr *expr;
|
||||
Ast_Resolved_Type *type;
|
||||
Ast_Type *type;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -466,7 +466,7 @@ ast_const(Token *pos, Intern_String name, Ast_Expr *expr){
|
||||
}
|
||||
|
||||
function Ast_Decl *
|
||||
ast_type(Token *pos, Intern_String name, Ast_Resolved_Type *type){
|
||||
ast_type(Token *pos, Intern_String name, Ast_Type *type){
|
||||
AST_NEW(Decl, TYPE, pos, AST_DECL);
|
||||
result->type = type_type;
|
||||
result->type_val = type;
|
||||
|
||||
Reference in New Issue
Block a user