AST - Set expressions

This commit is contained in:
Emmanuel BENOîT 2023-01-09 06:54:03 +01:00
parent 2b4ecf6d2c
commit 082acaaa1e

View file

@ -83,6 +83,17 @@ pub struct GetExpr {
pub name: Token, pub name: Token,
} }
/// A setter expression.
#[derive(Debug, Clone)]
pub struct SetExpr {
/// The instance being accessed.
pub instance: Box<ExprNode>,
/// The name of the property.
pub name: Token,
/// The value to set
pub value: Box<ExprNode>,
}
/// An AST node that represents an expression. /// An AST node that represents an expression.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum ExprNode { pub enum ExprNode {
@ -146,4 +157,6 @@ pub enum ExprNode {
/// A get expression. /// A get expression.
Get(GetExpr), Get(GetExpr),
/// A set expression.
Set(SetExpr),
} }