use super::*;
mod display;
#[derive(Clone, PartialEq, Eq, Hash, From)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum StatementKind {
Nothing,
Document(Box<DocumentationList>),
Annotation(Box<AttributeList>),
Namespace(Box<NamespaceDeclaration>),
Import(Box<ImportStatement>),
Class(Box<ClassDeclaration>),
Union(Box<UnionDeclaration>),
Enumerate(Box<FlagDeclaration>),
Trait(Box<TraitDeclaration>),
Extends(Box<ExtendsStatement>),
Function(Box<FunctionDeclaration>),
Variable(Box<LetBindNode>),
Guard(Box<GuardStatement>),
While(Box<WhileLoop>),
For(Box<ForLoop>),
Control(Box<ControlNode>),
Expression(Box<ExpressionNode>),
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct StatementContext {}
impl StatementKind {
pub fn expression(body: ExpressionKind, span: Range<u32>) -> Self {
Self::Expression(Box::new(ExpressionNode { omit: false, body, span: span.clone() }))
}
pub fn text<S: ToString>(s: S, span: Range<u32>) -> Self {
let literal = StringTextNode { text: s.to_string(), span: span.clone() };
Self::expression(ExpressionKind::Text(Box::new(literal)), span)
}
}