]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Creating the argument counter if requested
authorWolfgang Bumiller <blub@speed.at>
Sat, 12 Jan 2013 13:59:30 +0000 (14:59 +0100)
committerWolfgang Bumiller <blub@speed.at>
Sat, 12 Jan 2013 13:59:30 +0000 (14:59 +0100)
parser.c

index 8c34de16e00731182f78cfce073caee2755537cd..84c3e0907673fe5c9848bf5f5e1334713efb5a06 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -3998,6 +3998,12 @@ static bool parse_function_body(parser_t *parser, ast_value *var)
         }
     }
 
+    if (var->argcounter) {
+        ast_value *argc = ast_value_new(ast_ctx(var), var->argcounter, TYPE_FLOAT);
+        ast_block_collect(block, (ast_expression*)argc);
+        parser_addlocal(parser, argc->name, (ast_expression*)argc);
+    }
+
     func = ast_function_new(ast_ctx(var), var->name, var);
     if (!func) {
         parseerror(parser, "failed to allocate function for `%s`", var->name);