rune/ast/
expr_call.rs

1use crate::ast::prelude::*;
2
3#[test]
4#[cfg(not(miri))]
5fn ast_parse() {
6    rt::<ast::ExprCall>("test()");
7    rt::<ast::ExprCall>("(foo::bar)()");
8}
9
10/// A call expression.
11///
12/// * `<expr>(<args>)`.
13#[derive(Debug, TryClone, Parse, PartialEq, Eq, ToTokens, Spanned)]
14#[rune(parse = "meta_only")]
15#[non_exhaustive]
16pub struct ExprCall {
17    /// Attributes associated with expression.
18    #[rune(iter, meta)]
19    pub attributes: Vec<ast::Attribute>,
20    /// The name of the function being called.
21    #[rune(meta)]
22    pub expr: Box<ast::Expr>,
23    /// The arguments of the function call.
24    pub args: ast::Parenthesized<ast::Expr, T![,]>,
25    /// Opaque identifier related with call.
26    #[rune(skip)]
27    pub(crate) id: ItemId,
28}
29
30expr_parse!(Call, ExprCall, "call expression");