X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=ast.h;h=3df25e859b5ace2093365818ee616cd2de2f257b;hp=a0fa14defca70bfadeeee0224bf5936d6f6249b4;hb=2d654ddcff7b5de6173217044f89914a86557e69;hpb=1dce501b7058000e19421af246ec14fd98aceab9 diff --git a/ast.h b/ast.h index a0fa14d..3df25e8 100644 --- a/ast.h +++ b/ast.h @@ -51,6 +51,7 @@ typedef struct ast_breakcont_s ast_breakcont; typedef struct ast_switch_s ast_switch; typedef struct ast_label_s ast_label; typedef struct ast_goto_s ast_goto; +typedef struct ast_argpipe_s ast_argpipe; enum { TYPE_ast_node, /* 0 */ @@ -73,7 +74,8 @@ enum { TYPE_ast_breakcont, /* 17 */ TYPE_ast_switch, /* 18 */ TYPE_ast_label, /* 19 */ - TYPE_ast_goto /* 20 */ + TYPE_ast_goto, /* 20 */ + TYPE_ast_argpipe /* 21 */ }; #define ast_istype(x, t) ( ((ast_node*)x)->nodetype == (TYPE_##t) ) @@ -153,6 +155,9 @@ struct ast_expression_common #define AST_FLAG_INCLUDE_DEF (1<<5) #define AST_FLAG_IS_VARARG (1<<6) #define AST_FLAG_ALIAS (1<<7) +/* An array declared as [] + * so that the size is taken from the initializer */ +#define AST_FLAG_ARRAY_INIT (1<<8) #define AST_FLAG_TYPE_MASK (AST_FLAG_VARIADIC | AST_FLAG_NORETURN) /* Value @@ -180,11 +185,6 @@ struct ast_value_s const char *argcounter; - /* - int vtype; - ast_value *next; - */ - int cvq; /* const/var qualifier */ bool isfield; /* this declares a field */ bool isimm; /* an immediate, not just const */ @@ -231,6 +231,7 @@ void ast_type_adopt_impl(ast_expression *self, const ast_expression *other); void ast_type_to_string(ast_expression *e, char *buf, size_t bufsize); typedef enum ast_binary_ref_s { + AST_REF_NONE = 0, AST_REF_LEFT = 1 << 1, AST_REF_RIGHT = 1 << 2, AST_REF_ALL = (AST_REF_LEFT | AST_REF_RIGHT) @@ -367,6 +368,17 @@ struct ast_array_index_s }; ast_array_index* ast_array_index_new(lex_ctx ctx, ast_expression *array, ast_expression *index); +/* Vararg pipe node: + * + * copy all varargs starting from a specific index + */ +struct ast_argpipe_s +{ + ast_expression expression; + ast_expression *index; +}; +ast_argpipe* ast_argpipe_new(lex_ctx ctx, ast_expression *index); + /* Store * * Stores left<-right and returns left. @@ -557,7 +569,7 @@ struct ast_call_s }; ast_call* ast_call_new(lex_ctx ctx, ast_expression *funcexpr); -bool ast_call_check_types(ast_call*); +bool ast_call_check_types(ast_call*, ast_expression *this_func_va_type); /* Blocks *