commit c7d752aa8f0cc9f6b22c084c85c01837741d89a6
parent 678d2d5c594d9659050c2e337084aab1944f8be3
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 19 Apr 2021 18:13:23 -0400
hare::parse: fix delete_expr on object selector
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hare/parse/+test/expr.ha b/hare/parse/+test/expr.ha
@@ -49,6 +49,7 @@
delete(x[10]);
delete(x[10..20]);
delete(x[..]);
+ delete(x.y.z[..]);
free(x);
len([1, 2, 3, 4]);
size(u32);
diff --git a/hare/parse/expr.ha b/hare/parse/expr.ha
@@ -399,9 +399,8 @@ fn control(lexer: *lex::lexer) (ast::expr | error) = {
fn delete_expr(lexer: *lex::lexer) (ast::expr | error) = {
want(lexer, ltok::DELETE)?;
want(lexer, ltok::LPAREN)?;
- const expr = plain_expression(lexer)?;
- want(lexer, ltok::LBRACKET)?;
- const expr = alloc(indexing(lexer, expr)?);
+ const expr = alloc(postfix(lexer, void)?);
+ // TODO: Assert that this was an indexing expression
want(lexer, ltok::RPAREN)?;
return expr: ast::delete_expr;
};