use ryo_source::pure::PureStmt;
use ryo_symbol::SymbolId;
use crate::Mutation;
#[derive(Debug, Clone)]
pub struct RemoveStatementMutation {
pub target_stmt: PureStmt,
pub pattern: String,
pub target_fn: SymbolId,
pub remove_all: bool,
}
impl RemoveStatementMutation {
pub fn new(target_stmt: PureStmt, pattern: String, target_fn: SymbolId) -> Self {
Self {
target_stmt,
pattern,
target_fn,
remove_all: true,
}
}
pub fn first_only(mut self) -> Self {
self.remove_all = false;
self
}
}
impl Mutation for RemoveStatementMutation {
fn describe(&self) -> String {
"Remove statements matching target".to_string()
}
fn mutation_type(&self) -> &'static str {
"RemoveStatement"
}
fn box_clone(&self) -> Box<dyn Mutation> {
Box::new(self.clone())
}
}