Fix match expression parsing
This commit is contained in:
parent
196954326e
commit
a96fbc9592
@ -627,11 +627,13 @@ impl Parser {
|
|||||||
|
|
||||||
parse_method!(match_expr(&mut self) -> ParseResult<Expression> {
|
parse_method!(match_expr(&mut self) -> ParseResult<Expression> {
|
||||||
expect!(self, Keyword(Kw::Match));
|
expect!(self, Keyword(Kw::Match));
|
||||||
let expr = self.expression()?;
|
let expr = {
|
||||||
//TODO abstract these errors into the delimited macro
|
self.restrictions.no_struct_literal = true;
|
||||||
//expect!(self, LCurlyBrace, "Expected '{'");
|
let x = self.expression();
|
||||||
|
self.restrictions.no_struct_literal = false;
|
||||||
|
x?
|
||||||
|
};
|
||||||
let body = self.match_body()?;
|
let body = self.match_body()?;
|
||||||
//expect!(self, RCurlyBrace, "Expected '}'");
|
|
||||||
Ok(Expression(ExpressionType::MatchExpression(bx!(expr), body), None))
|
Ok(Expression(ExpressionType::MatchExpression(bx!(expr), body), None))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user