]> 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 86bb18379f277ca1710e8856f1655ef510d40cc3..3dc30b2221c4c278906eb3a076ff7bbb934a1d13 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
  *
@@ -109,16 +111,12 @@ struct ast_value_s
         const char   *vstring;
         int           ventity;
         ast_function *vfunc;
+        quaternion    vquat;
+        matrix        vmat;
     } 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 */
@@ -130,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.
@@ -180,7 +180,6 @@ struct ast_return_s
     ast_expression *operand;
 };
 ast_return* ast_return_new(lex_ctx    ctx,
-                           int        op,
                            ast_expression *expr);
 void ast_return_delete(ast_return*);
 
@@ -360,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);
@@ -398,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 */