X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=ast.h;h=bb7a3170a7c108a51d6792cb5588fee64e1a9ac0;hp=1f3029fe1a6b30d15022dccb1826536a0148db6c;hb=a68f0fcb355db42acabe72da5939fbd1b04f6016;hpb=d6ca5673dc7f2760faca1200477808d919a290ca diff --git a/ast.h b/ast.h index 1f3029f..bb7a317 100644 --- a/ast.h +++ b/ast.h @@ -176,6 +176,7 @@ typedef union { ast_function *vfunc; ast_value *vfield; } basic_value_t; + struct ast_value_s { ast_expression expression; @@ -339,7 +340,7 @@ ast_entfield* ast_entfield_new_force(lex_ctx_t ctx, ast_expression *entity, ast_ */ struct ast_member_s { - ast_expression expression; + ast_expression expression; ast_expression *owner; unsigned int field; const char *name; @@ -362,7 +363,7 @@ bool ast_member_set_name(ast_member*, const char *name); */ struct ast_array_index_s { - ast_expression expression; + ast_expression expression; ast_expression *array; ast_expression *index; }; @@ -374,7 +375,7 @@ ast_array_index* ast_array_index_new(lex_ctx_t ctx, ast_expression *array, ast_e */ struct ast_argpipe_s { - ast_expression expression; + ast_expression expression; ast_expression *index; }; ast_argpipe* ast_argpipe_new(lex_ctx_t ctx, ast_expression *index); @@ -386,7 +387,7 @@ ast_argpipe* ast_argpipe_new(lex_ctx_t ctx, ast_expression *index); */ struct ast_store_s { - ast_expression expression; + ast_expression expression; int op; ast_expression *dest; ast_expression *source; @@ -407,7 +408,7 @@ ast_store* ast_store_new(lex_ctx_t ctx, int op, */ struct ast_ifthen_s { - ast_expression expression; + ast_expression expression; ast_expression *cond; /* It's all just 'expressions', since an ast_block is one too. */ ast_expression *on_true; @@ -430,7 +431,7 @@ ast_ifthen* ast_ifthen_new(lex_ctx_t ctx, ast_expression *cond, ast_expression * */ struct ast_ternary_s { - ast_expression expression; + ast_expression expression; ast_expression *cond; /* It's all just 'expressions', since an ast_block is one too. */ ast_expression *on_true; @@ -463,7 +464,7 @@ continue: // a 'continue' will jump here */ struct ast_loop_s { - ast_expression expression; + ast_expression expression; ast_expression *initexpr; ast_expression *precond; ast_expression *postcond; @@ -489,9 +490,9 @@ ast_loop* ast_loop_new(lex_ctx_t ctx, */ struct ast_breakcont_s { - ast_expression expression; - bool is_continue; - unsigned int levels; + ast_expression expression; + bool is_continue; + unsigned int levels; }; ast_breakcont* ast_breakcont_new(lex_ctx_t ctx, bool iscont, unsigned int levels); @@ -511,7 +512,7 @@ typedef struct { } ast_switch_case; struct ast_switch_s { - ast_expression expression; + ast_expression expression; ast_expression *operand; ast_switch_case *cases; @@ -525,12 +526,13 @@ ast_switch* ast_switch_new(lex_ctx_t ctx, ast_expression *op); */ struct ast_label_s { - ast_expression expression; - const char *name; - ir_block *irblock; - ast_goto **gotos; + ast_expression expression; + const char *name; + ir_block *irblock; + ast_goto **gotos; + /* means it has not yet been defined */ - bool undefined; + bool undefined; }; ast_label* ast_label_new(lex_ctx_t ctx, const char *name, bool undefined); @@ -541,10 +543,10 @@ ast_label* ast_label_new(lex_ctx_t ctx, const char *name, bool undefined); */ struct ast_goto_s { - ast_expression expression; - const char *name; - ast_label *target; - ir_block *irblock_from; + ast_expression expression; + const char *name; + ast_label *target; + ir_block *irblock_from; }; ast_goto* ast_goto_new(lex_ctx_t ctx, const char *name); @@ -562,9 +564,9 @@ void ast_goto_set_label(ast_goto*, ast_label*); */ struct ast_call_s { - ast_expression expression; + ast_expression expression; ast_expression *func; - ast_expression* *params; + ast_expression **params; ast_expression *va_count; }; ast_call* ast_call_new(lex_ctx_t ctx, @@ -576,7 +578,7 @@ bool ast_call_check_types(ast_call*, ast_expression *this_func_va_type); */ struct ast_block_s { - ast_expression expression; + ast_expression expression; ast_value* *locals; ast_expression* *exprs; @@ -601,7 +603,7 @@ bool GMQCC_WARN ast_block_add_expr(ast_block*, ast_expression*); */ struct ast_function_s { - ast_node node; + ast_node node; ast_value *vtype; const char *name; @@ -642,7 +644,7 @@ void ast_function_delete(ast_function*); /* For "optimized" builds this can just keep returning "foo"... * or whatever... */ -/*const char* ast_function_label(ast_function*, const char *prefix);*/ +const char* ast_function_label(ast_function*, const char *prefix); bool ast_function_codegen(ast_function *self, ir_builder *builder); bool ast_generate_accessors(ast_value *asvalue, ir_builder *ir);