ryo_mutations/basic/stmt/
remove_statement.rs1use ryo_source::pure::PureStmt;
13use ryo_symbol::SymbolId;
14
15use crate::Mutation;
16
17#[derive(Debug, Clone)]
19pub struct RemoveStatementMutation {
20 pub target_stmt: PureStmt,
22 pub pattern: String,
24 pub target_fn: SymbolId,
26 pub remove_all: bool,
28}
29
30impl RemoveStatementMutation {
31 pub fn new(target_stmt: PureStmt, pattern: String, target_fn: SymbolId) -> Self {
32 Self {
33 target_stmt,
34 pattern,
35 target_fn,
36 remove_all: true,
37 }
38 }
39
40 pub fn first_only(mut self) -> Self {
42 self.remove_all = false;
43 self
44 }
45}
46
47impl Mutation for RemoveStatementMutation {
48 fn describe(&self) -> String {
49 "Remove statements matching target".to_string()
50 }
51
52 fn mutation_type(&self) -> &'static str {
53 "RemoveStatement"
54 }
55
56 fn box_clone(&self) -> Box<dyn Mutation> {
57 Box::new(self.clone())
58 }
59}