]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Add some more output and field types so you can now properly call 'get_a_function_whi...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 1 Dec 2012 15:11:04 +0000 (16:11 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 1 Dec 2012 15:11:04 +0000 (16:11 +0100)
ast.c

diff --git a/ast.c b/ast.c
index 57a098f5ee6e814aad0e7631b848b42b23b44c0d..8ad77ca4cb053d50cd0222226f22869c327e3afe 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -855,9 +855,12 @@ ast_call* ast_call_new(lex_ctx ctx,
     self->params = NULL;
     self->func   = funcexpr;
 
+/*
     self->expression.vtype = funcexpr->expression.next->expression.vtype;
     if (funcexpr->expression.next->expression.next)
         self->expression.next = ast_type_copy(ctx, funcexpr->expression.next->expression.next);
+*/
+    ast_type_adopt(self, funcexpr->expression.next);
 
     return self;
 }
@@ -1987,6 +1990,10 @@ bool ast_entfield_codegen(ast_entfield *self, ast_function *func, bool lvalue, i
     } else {
         *out = ir_block_create_load_from_ent(func->curblock, ast_ctx(self), ast_function_label(func, "efv"),
                                              ent, field, self->expression.vtype);
+        if ((*out)->vtype == TYPE_FIELD)
+            (*out)->fieldtype = self->expression.next->expression.vtype;
+        if ((*out)->vtype == TYPE_FUNCTION)
+            (*out)->outtype = self->expression.next->expression.vtype;
     }
     if (!*out) {
         compile_error(ast_ctx(self), "failed to create %s instruction (output type %s)",
@@ -2870,6 +2877,11 @@ bool ast_call_codegen(ast_call *self, ast_function *func, bool lvalue, ir_value
     *out = ir_call_value(callinstr);
     self->expression.outr = *out;
 
+    if ((*out)->vtype == TYPE_FIELD)
+        (*out)->fieldtype = self->expression.next->expression.vtype;
+    if ((*out)->vtype == TYPE_FUNCTION)
+        (*out)->outtype = self->expression.next->expression.vtype;
+
     vec_free(params);
     return true;
 error: