mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-17 09:02:25 +00:00
Keep track of blocklocal in parser_parse_block
This commit is contained in:
parent
c43bb71aa7
commit
5ffa0dda8e
1 changed files with 11 additions and 3 deletions
14
parser.c
14
parser.c
|
@ -173,11 +173,15 @@ bool parser_body_do(parser_t *parser, ast_block *block)
|
|||
|
||||
ast_block* parser_parse_block(parser_t *parser)
|
||||
{
|
||||
ast_block *block;
|
||||
size_t oldblocklocal;
|
||||
ast_block *block = NULL;
|
||||
|
||||
oldblocklocal = parser->blocklocal;
|
||||
parser->blocklocal = parser->locals_count;
|
||||
|
||||
if (!parser_next(parser)) { /* skip the '{' */
|
||||
parseerror(parser, "expected function body");
|
||||
return NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
block = ast_block_new(parser_ctx(parser));
|
||||
|
@ -189,9 +193,13 @@ ast_block* parser_parse_block(parser_t *parser)
|
|||
|
||||
if (!parser_body_do(parser, block)) {
|
||||
ast_block_delete(block);
|
||||
return NULL;
|
||||
block = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
parser->blocklocal = oldblocklocal;
|
||||
return block;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue