]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
More verbose error for invalid parameter types
authorWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 21 Nov 2012 19:53:00 +0000 (20:53 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 21 Nov 2012 19:53:00 +0000 (20:53 +0100)
ast.c

diff --git a/ast.c b/ast.c
index b1ceb1c6b990414800bf6d0619af358e17b01b3f..f6a5d87455150021484edcffee3d4ebb389e0d07 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -783,8 +783,12 @@ bool ast_call_check_types(ast_call *self)
 
     for (i = 0; i < count; ++i) {
         if (!ast_compare_type(self->params[i], (ast_expression*)(func->expression.params[i]))) {
-            asterror(ast_ctx(self), "invalid type for parameter %u in function call",
-                     (unsigned int)(i+1));
+            char texp[1024];
+            char tgot[1024];
+            ast_type_to_string(self->params[i], tgot, sizeof(tgot));
+            ast_type_to_string((ast_expression*)func->expression.params[i], texp, sizeof(texp));
+            asterror(ast_ctx(self), "invalid type for parameter %u in function call: expected %s, got %s",
+                     (unsigned int)(i+1), texp, tgot);
             /* we don't immediately return */
             retval = false;
         }