Better handling of multiple body functions.

This commit is contained in:
Dale Weiler 2013-02-05 03:28:20 +00:00
parent 8e1cd4b1df
commit 31ce4c2afa

View file

@ -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); func = ast_function_new(ast_ctx(var), var->name, var);
if (!func) { if (!func) {
parseerror(parser, "failed to allocate function for `%s`", var->name); parseerror(parser, "failed to allocate function for `%s`", var->name);