darklua_core/rules/rename_variables/
function_names.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::nodes::LocalFunctionStatement;
use crate::process::NodeProcessor;

#[derive(Debug, Clone, Default)]
pub struct CollectFunctionNames {
    names: Vec<String>,
}

impl From<CollectFunctionNames> for Vec<String> {
    fn from(collector: CollectFunctionNames) -> Self {
        collector.names
    }
}

impl NodeProcessor for CollectFunctionNames {
    fn process_local_function_statement(&mut self, function: &mut LocalFunctionStatement) {
        self.names
            .push(function.get_identifier().get_name().to_owned());
    }
}