Struct darklua_core::process::processors::FindVariables [−][src]
pub struct FindVariables<'a> { /* fields omitted */ }
Expand description
A processor to find usage of a given set of identifiers.
Example
The following example illustrate how you can use this processor to find usage of the
foo
variable.
let variables = vec!["foo".to_owned()];
let mut find_foo = FindVariables::from(&variables);
let mut foo_expression = Expression::identifier("foo");
DefaultVisitor::visit_expression(&mut foo_expression, &mut find_foo);
assert!(find_foo.has_found_usage());
If you pass a node that does not contain the given variable, the processor will return
false when calling the has_found_usage()
method.
let mut bar_expression = Expression::identifier("bar");
DefaultVisitor::visit_expression(&mut bar_expression, &mut find_foo);
assert!(!find_foo.has_found_usage());
Implementations
Trait Implementations
Performs the conversion.