use crate::{Block, Expression, Indent, Node, NodeID};
use leo_span::Span;
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AsyncExpression {
pub block: Block,
pub span: Span,
pub id: NodeID,
}
impl fmt::Display for AsyncExpression {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f, "async {{")?;
for stmt in self.block.statements.iter() {
writeln!(f, "{}{}", Indent(stmt), stmt.semicolon())?;
}
write!(f, "}}")
}
}
impl From<AsyncExpression> for Expression {
fn from(value: AsyncExpression) -> Self {
Expression::Async(value)
}
}
crate::simple_node_impl!(AsyncExpression);