Add back parser restrictions
This commit is contained in:
parent
3cf3fce72d
commit
44d1f4692f
@ -133,7 +133,7 @@ test_in_fresh_env!(source, "\"x\"");
|
||||
fn boolean_pattern() {
|
||||
let source = r#"
|
||||
let a = true
|
||||
if a {
|
||||
if a {
|
||||
is true then "x",
|
||||
is false then "y"
|
||||
}
|
||||
|
@ -813,12 +813,15 @@ impl Parser {
|
||||
#[recursive_descent_method]
|
||||
fn if_expr(&mut self) -> ParseResult<Expression> {
|
||||
expect!(self, Keyword(Kw::If));
|
||||
let old_struct_value = self.restrictions.no_struct_literal;
|
||||
self.restrictions.no_struct_literal = true;
|
||||
let discriminator = if let LCurlyBrace = self.token_handler.peek_kind() {
|
||||
None
|
||||
} else {
|
||||
Some(Box::new(self.expression()?))
|
||||
};
|
||||
let body = Box::new(self.if_expr_body()?);
|
||||
self.restrictions.no_struct_literal = old_struct_value;
|
||||
Ok(Expression::new(self.id_store.fresh(), ExpressionKind::IfExpression { discriminator, body }))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user