cl-ast: Move ExprKind::Assign outside the box, to be more consistent with other uses of Expr
This commit is contained in:
parent
ba148ef5de
commit
8ee318f26b
@ -292,7 +292,7 @@ pub struct Expr {
|
|||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum ExprKind {
|
pub enum ExprKind {
|
||||||
/// An [Assign]ment expression: [`Expr`] ([`AssignKind`] [`Expr`])\+
|
/// An [Assign]ment expression: [`Expr`] ([`AssignKind`] [`Expr`])\+
|
||||||
Assign(Box<Assign>),
|
Assign(Assign),
|
||||||
/// A [Binary] expression: [`Expr`] ([`BinaryKind`] [`Expr`])\+
|
/// A [Binary] expression: [`Expr`] ([`BinaryKind`] [`Expr`])\+
|
||||||
Binary(Binary),
|
Binary(Binary),
|
||||||
/// A [Unary] expression: [`UnaryKind`]\* [`Expr`]
|
/// A [Unary] expression: [`UnaryKind`]\* [`Expr`]
|
||||||
@ -338,7 +338,7 @@ pub enum ExprKind {
|
|||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Assign {
|
pub struct Assign {
|
||||||
pub head: Expr,
|
pub head: Box<Expr>,
|
||||||
pub op: AssignKind,
|
pub op: AssignKind,
|
||||||
pub tail: Box<Expr>,
|
pub tail: Box<Expr>,
|
||||||
}
|
}
|
||||||
|
@ -675,7 +675,14 @@ impl<'t> Parser<'t> {
|
|||||||
let Ok(op) = self.assign_op() else {
|
let Ok(op) = self.assign_op() else {
|
||||||
return Ok(head.kind);
|
return Ok(head.kind);
|
||||||
};
|
};
|
||||||
Ok(Assign { head, op, tail: self.expr_from(Self::exprkind_assign)?.into() }.into())
|
Ok(
|
||||||
|
Assign {
|
||||||
|
head: Box::new(head),
|
||||||
|
op,
|
||||||
|
tail: self.expr_from(Self::exprkind_assign)?.into(),
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
// TODO: use a pratt parser for binary expressions, to simplify this
|
// TODO: use a pratt parser for binary expressions, to simplify this
|
||||||
binary! {
|
binary! {
|
||||||
|
Loading…
Reference in New Issue
Block a user