harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 9bd4abbd0d5cd16688fda24a9a3128c49e5340b8
parent f6d5897c521287dede383aeb724efb72068c2e8b
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Sat, 13 Mar 2021 13:13:06 -0500

parse: fix static asserts in postfix expressions

Fixes `fn foo() void = static assert(true);`

Diffstat:
Msrc/parse.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/parse.c b/src/parse.c @@ -1444,8 +1444,12 @@ parse_postfix_expression(struct lexer *lexer, struct ast_expression *lvalue) case T_STATIC: synassert(lvalue == NULL, &tok, T_LPAREN, T_DOT, T_LBRACKET, T_EOF); - unlex(lexer, &tok); - return parse_assertion_expression(lexer, false); + if (tok.token == T_STATIC) { + return parse_assertion_expression(lexer, true); + } else { + unlex(lexer, &tok); + return parse_assertion_expression(lexer, false); + } case T_SIZE: case T_LEN: case T_OFFSET: