]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.c
Added support for some modelgen/spritegen commands
[xonotic/gmqcc.git] / ast.c
diff --git a/ast.c b/ast.c
index c99a051b36fefb48a613f56d8348f6b6ed81874c..d8bd293d451b5e6671a495ec188190c004055237 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -846,6 +846,11 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
         return true;
     }
 
+    if (!self->blocks_count) {
+        asterror(ast_ctx(self), "function `%s` has no body", self->name);
+        return false;
+    }
+
     self->curblock = ir_function_create_block(irf, "entry");
     if (!self->curblock)
         return false;
@@ -867,6 +872,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
         else
         {
             /* error("missing return"); */
+            asterror(ast_ctx(self), "function `%s` missing return value", self->name);
             return false;
         }
     }
@@ -1013,7 +1019,7 @@ bool ast_binstore_codegen(ast_binstore *self, ast_function *func, bool lvalue, i
     /* for a binstore we need both an lvalue and an rvalue for the left side */
     /* rvalue of destination! */
     cgen = self->dest->expression.codegen;
-    if (!(*cgen)((ast_expression*)(self->dest), func, true, &leftr))
+    if (!(*cgen)((ast_expression*)(self->dest), func, false, &leftr))
         return false;
 
     /* source as rvalue only */