rune/ast/
expr_assign.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use crate::ast::prelude::*;

#[test]
#[cfg(not(miri))]
fn ast_parse() {
    rt::<ast::ExprAssign>("a = 2");
    rt::<ast::ExprAssign>("a = b = 3");
}

/// An assign expression.
///
/// * `a = b`.
#[derive(Debug, TryClone, PartialEq, Eq, ToTokens, Spanned)]
#[non_exhaustive]
pub struct ExprAssign {
    /// Attributes associated with the assign expression.
    #[rune(iter)]
    pub attributes: Vec<ast::Attribute>,
    /// The expression being assigned to.
    pub lhs: Box<ast::Expr>,
    /// The equals sign `=`.
    pub eq: T![=],
    /// The value.
    pub rhs: Box<ast::Expr>,
}

expr_parse!(Assign, ExprAssign, "assign expression");