This doesn't need to be a closure
This commit is contained in:
parent
ac576be604
commit
24b532df06
@ -694,12 +694,12 @@ impl Parser {
|
|||||||
|
|
||||||
parse_method!(if_expr(&mut self) -> ParseResult<Expression> {
|
parse_method!(if_expr(&mut self) -> ParseResult<Expression> {
|
||||||
expect!(self, Keyword(Kw::If), "'if'");
|
expect!(self, Keyword(Kw::If), "'if'");
|
||||||
let condition = (|| {
|
let condition = {
|
||||||
self.restrictions.no_struct_literal = true;
|
self.restrictions.no_struct_literal = true;
|
||||||
let x = self.expression();
|
let x = self.expression();
|
||||||
self.restrictions.no_struct_literal = false;
|
self.restrictions.no_struct_literal = false;
|
||||||
x
|
x?
|
||||||
})()?;
|
};
|
||||||
let then_clause = self.block()?;
|
let then_clause = self.block()?;
|
||||||
let else_clause = self.else_clause()?;
|
let else_clause = self.else_clause()?;
|
||||||
Ok(Expression(ExpressionType::IfExpression(bx!(condition), then_clause, else_clause), None))
|
Ok(Expression(ExpressionType::IfExpression(bx!(condition), then_clause, else_clause), None))
|
||||||
|
Loading…
Reference in New Issue
Block a user