use crate::ast::prelude::*;
#[test]
#[cfg(not(miri))]
fn ast_parse() {
rt::<ast::Local>("let x = 1;");
rt::<ast::Local>("#[attr] let a = f();");
rt::<ast::Local>("let a = b{}().foo[0].await;");
}
#[derive(Debug, TryClone, PartialEq, Eq, ToTokens, Parse, Spanned)]
#[non_exhaustive]
pub struct Local {
#[rune(iter, meta)]
pub attributes: Vec<ast::Attribute>,
pub let_token: T![let],
#[rune(iter)]
pub mut_token: Option<T![mut]>,
pub pat: ast::Pat,
pub eq: T![=],
#[rune(parse_with = "parse_expr")]
pub expr: ast::Expr,
pub semi: T![;],
}
fn parse_expr(p: &mut Parser<'_>) -> Result<ast::Expr> {
ast::Expr::parse_with(
p,
ast::expr::EAGER_BRACE,
ast::expr::EAGER_BINARY,
ast::expr::CALLABLE,
)
}