mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-22 02:31:28 +00:00
parse ahead into the return expression as expected
This commit is contained in:
parent
e1c4600260
commit
5d766f60b2
1 changed files with 8 additions and 1 deletions
9
parser.c
9
parser.c
|
@ -560,8 +560,15 @@ static bool parser_body_do(parser_t *parser, ast_block *block)
|
|||
{
|
||||
if (!strcmp(parser_tokval(parser), "return"))
|
||||
{
|
||||
ast_expression *exp = parser_expression(parser);
|
||||
ast_expression *exp;
|
||||
ast_return *ret;
|
||||
|
||||
if (!parser_next(parser)) {
|
||||
parseerror(parser, "expected return expression");
|
||||
return false;
|
||||
}
|
||||
|
||||
exp = parser_expression(parser);
|
||||
if (!exp)
|
||||
return false;
|
||||
ret = ast_return_new(exp->expression.node.context, exp);
|
||||
|
|
Loading…
Reference in a new issue