From 31ce4c2afa0ffbbcbd61cb593b7be54d1de48c00 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Tue, 5 Feb 2013 03:28:20 +0000 Subject: [PATCH] Better handling of multiple body functions. --- parser.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/parser.c b/parser.c index aa536c5..3375acc 100644 --- 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);