]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.h
Merge branch 'master' into blub/bc3
[xonotic/gmqcc.git] / ast.h
diff --git a/ast.h b/ast.h
index e88e01603b53c462adbe08488a39fa9461a4beb5..61bacce6787ceaff6f5adf563a803c1bc97866a0 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -81,7 +81,9 @@ typedef struct
     ast_expression_codegen *codegen;
     int                     vtype;
     ast_expression         *next;
+    MEM_VECTOR_MAKE(ast_value*, params);
 } ast_expression_common;
+MEM_VECTOR_PROTO(ast_expression_common, ast_value*, params);
 
 /* Value
  *
@@ -114,13 +116,7 @@ struct ast_value_s
     } constval;
 
     ir_value *ir_v;
-
-    /* if vtype is qc_function, params contain parameters, and
-     * 'next' the return type.
-     */
-    MEM_VECTOR_MAKE(ast_value*, params);
 };
-MEM_VECTOR_PROTO(ast_value, ast_value*, params);
 
 ast_value* ast_value_new(lex_ctx ctx, const char *name, int qctype);
 /* This will NOT delete an underlying ast_function */
@@ -132,6 +128,8 @@ bool ast_value_codegen(ast_value*, ast_function*, bool lvalue, ir_value**);
 bool ast_local_codegen(ast_value *self, ir_function *func, bool isparam);
 bool ast_global_codegen(ast_value *self, ir_builder *ir);
 
+bool GMQCC_WARN ast_value_params_add(ast_value*, ast_value*);
+
 /* Binary
  *
  * A value-returning binary expression.
@@ -222,11 +220,11 @@ struct ast_store_s
 {
     ast_expression_common expression;
     int             op;
-    ast_value      *dest; /* When we add pointers this might have to change to expression */
+    ast_expression *dest;
     ast_expression *source;
 };
 ast_store* ast_store_new(lex_ctx ctx, int op,
-                         ast_value *d, ast_expression *s);
+                         ast_expression *d, ast_expression *s);
 void ast_store_delete(ast_store*);
 
 bool ast_store_codegen(ast_store*, ast_function*, bool lvalue, ir_value**);
@@ -361,6 +359,7 @@ struct ast_block_s
 };
 ast_block* ast_block_new(lex_ctx ctx);
 void ast_block_delete(ast_block*);
+bool ast_block_set_type(ast_block*, ast_expression *from);
 
 MEM_VECTOR_PROTO(ast_block, ast_value*, locals);
 MEM_VECTOR_PROTO(ast_block, ast_expression*, exprs);
@@ -399,13 +398,6 @@ struct ast_function_s
     char         labelbuf[64];
 
     MEM_VECTOR_MAKE(ast_block*, blocks);
-
-    /* contrary to the params in ast_value, these are the parameter variables
-     * which are to be used in expressions.
-     * The ast_value for the function contains only the parameter types used
-     * to generate ast_calls, and ast_call contains the parameter values
-     * used in that call.
-     */
 };
 ast_function* ast_function_new(lex_ctx ctx, const char *name, ast_value *vtype);
 /* This will NOT delete the underlying ast_value */