]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Better handling of multiple body functions.
authorDale Weiler <killfieldengine@gmail.com>
Tue, 5 Feb 2013 03:28:20 +0000 (03:28 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Tue, 5 Feb 2013 03:28:20 +0000 (03:28 +0000)
parser.c

index aa536c50ac8161f4cba91617781cfb2603c4aa7e..3375accf1864cf203631bd79df9a4acbef6da04a 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -3981,6 +3981,12 @@ static bool parse_function_body(parser_t *parser, ast_value *var)
         }
     }
 
+    if (var->hasvalue) {
+        parseerror(parser, "function `%s` declared with multiple bodies", var->name);
+        ast_block_delete(block);
+        goto enderr;
+    }
+
     func = ast_function_new(ast_ctx(var), var->name, var);
     if (!func) {
         parseerror(parser, "failed to allocate function for `%s`", var->name);