1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
use crate::ast;
use runestick::unit::Span;

/// A try expression `<expr>?`.
#[derive(Debug, Clone)]
pub struct ExprTry {
    /// The expression being awaited.
    pub expr: Box<ast::Expr>,
    /// The try operator.
    pub try_: ast::Try,
}

impl ExprTry {
    /// Access the span of the expression.
    pub fn span(&self) -> Span {
        self.expr.span().join(self.try_.span())
    }
}