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
28
29
30
31
32
33
use crate::ast::{Await, Dot, Expr};
use crate::error::{ParseError, Result};
use crate::parser::Parser;
use crate::traits::Parse;
use runestick::unit::Span;
#[derive(Debug, Clone)]
pub struct ExprAwait {
pub expr: Box<Expr>,
pub dot: Dot,
pub await_: Await,
}
impl ExprAwait {
pub fn span(&self) -> Span {
self.expr.span().join(self.await_.span())
}
}
impl Parse for ExprAwait {
fn parse(parser: &mut Parser<'_>) -> Result<Self, ParseError> {
Ok(Self {
expr: Box::new(parser.parse()?),
dot: parser.parse()?,
await_: parser.parse()?,
})
}
}