sway_core/language/parsed/
program.rsuse strum::EnumString;
use crate::Engines;
use super::ParseModule;
#[derive(Debug, Clone)]
pub struct ParseProgram {
pub kind: TreeType,
pub root: ParseModule,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, EnumString)]
pub enum TreeType {
#[strum(serialize = "predicate")]
Predicate,
#[strum(serialize = "script")]
Script,
#[strum(serialize = "contract")]
Contract,
#[strum(serialize = "library")]
Library,
}
impl std::fmt::Display for TreeType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
match self {
Self::Predicate => "predicate",
Self::Script => "script",
Self::Contract => "contract",
Self::Library => "library",
}
)
}
}
impl ParseProgram {
pub(crate) fn exclude_tests(&mut self, engines: &Engines) {
self.root.tree.exclude_tests(engines)
}
}