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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use super::Node;
use crate::{exec::Executable, BoaProfiler, Context, JsResult, JsValue};
use gc::{Finalize, Trace};
use std::fmt;
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};
#[cfg(test)]
mod tests;
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct AwaitExpr {
expr: Box<Node>,
}
impl Executable for AwaitExpr {
fn run(&self, _: &mut Context) -> JsResult<JsValue> {
let _timer = BoaProfiler::global().start_event("AwaitExpression", "exec");
Ok(JsValue::undefined())
}
}
impl<T> From<T> for AwaitExpr
where
T: Into<Box<Node>>,
{
fn from(e: T) -> Self {
Self { expr: e.into() }
}
}
impl fmt::Display for AwaitExpr {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "await ")?;
self.expr.display(f, 0)
}
}
impl From<AwaitExpr> for Node {
fn from(awaitexpr: AwaitExpr) -> Self {
Self::AwaitExpr(awaitexpr)
}
}