]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - test/ast-macros.h
Merge branch 'master' into blub/bc3
[xonotic/gmqcc.git] / test / ast-macros.h
index 5b92a388c41a231975f61e028d0ce587093f02bc..ebb3a5bd6b7b09807622a90c8ef9523f0b09e4bb 100644 (file)
@@ -42,7 +42,7 @@ do {                                             \
 } while(0)
 
 #define ASSIGN(op, a, b) \
-(ast_expression*)ast_store_new(ctx, INSTR_##op, (a), (ast_expression*)(b))
+(ast_expression*)ast_store_new(ctx, INSTR_##op, (ast_expression*)(a), (ast_expression*)(b))
 
 #define BIN(op, a, b) \
 (ast_expression*)ast_binary_new(ctx, INSTR_##op, (ast_expression*)(a), (ast_expression*)(b))
@@ -77,6 +77,7 @@ do {                                                   \
 #define BUILTIN(name, outtype, number)                              \
 do {                                                                \
     ast_function *func_##name;                                      \
+    ast_value    *thisfuncval;                                      \
     ast_function *thisfunc;                                         \
     DEFVAR(return_##name);                                          \
     VARnamed(TYPE_FUNCTION, name, name);                            \
@@ -86,6 +87,8 @@ do {                                                                \
     func_##name = ast_function_new(ctx, #name, name);               \
     thisfunc = func_##name;                                         \
     (void)thisfunc;                                                 \
+    thisfuncval = name;                                             \
+    (void)thisfuncval;                                              \
     assert(functions_add(func_##name) >= 0);                        \
     func_##name->builtin = number;
 
@@ -95,7 +98,7 @@ do {                                                                \
 do {                                                 \
     DEFVAR(parm);                                    \
     VARnamed(ptype, parm, name);                     \
-    assert(ast_function_params_add(thisfunc, parm)); \
+    assert(ast_value_params_add(thisfuncval, parm)); \
 } while(0)
 
 #define FUNCTION(name, outtype)                                   \