commit c24c4f5921738cd6bc76cad7803b429ccb59e72d
parent 48d467b1bec34d91d50a5ddaa7e9b7b699d638ea
Author: Eyal Sawady <ecs@d2evs.net>
Date: Thu, 2 Sep 2021 04:09:39 +0000
hare::parse::unarithm: allow &unary-expression
Signed-off-by: Eyal Sawady <ecs@d2evs.net>
Diffstat:
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/hare/parse/+test/expr.ha b/hare/parse/+test/expr.ha
@@ -250,7 +250,7 @@
"export fn main() void = *void;\n"
"export fn main() void = ~void;\n"
"export fn main() void = !void;\n"
- "export fn main() void = &x;\n");
+ "export fn main() void = &void;\n");
};
@test fn yield_expr() void = {
diff --git a/hare/parse/expr.ha b/hare/parse/expr.ha
@@ -1056,9 +1056,7 @@ fn unarithm(lexer: *lex::lexer) (ast::expr | error) = {
ltok::BAND => ast::unarithm_op::ADDR,
* => abort(),
};
- let operand =
- if (tok.0 == ltok::BAND) objsel(lexer)?
- else unarithm(lexer)?;
+ let operand = unarithm(lexer)?;
return ast::expr {
start = tok.2,
end = lex::prevloc(lexer),