From 2cf4b4e56dc0783a837efb91a3db81c98b4e4fc3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 31 Dec 2012 11:39:00 +0100 Subject: [PATCH] Explicitly allow 'return nil' --- parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/parser.c b/parser.c index edf4f2a..8fe2c31 100644 --- a/parser.c +++ b/parser.c @@ -2534,7 +2534,9 @@ static bool parse_return(parser_t *parser, ast_block *block, ast_expression **ou if (!exp) return false; - if (exp->expression.vtype != expected->expression.next->expression.vtype) { + if (exp->expression.vtype != TYPE_NIL && + exp->expression.vtype != expected->expression.next->expression.vtype) + { parseerror(parser, "return with invalid expression"); } -- 2.39.2