luaur_analysis/methods/
find_node_visit_ast_query_alt_b.rs1use crate::records::find_node::FindNode;
2use luaur_ast::records::ast_node::AstNode;
3use luaur_ast::records::ast_stat_function::AstStatFunction;
4use luaur_ast::visit::ast_expr_visit;
5
6impl FindNode {
7 pub fn visit_ast_stat_function(&mut self, node: *mut AstStatFunction) -> bool {
8 let node_ref = unsafe { &*node };
9
10 self.visit_ast_node(node as *mut AstNode);
11
12 if unsafe {
13 node_ref
14 .name
15 .as_ref()
16 .unwrap()
17 .base
18 .location
19 .contains(self.pos)
20 } {
21 unsafe {
22 ast_expr_visit(node_ref.name, self);
23 }
24 } else if unsafe {
25 node_ref
26 .func
27 .as_ref()
28 .unwrap()
29 .base
30 .base
31 .location
32 .contains(self.pos)
33 } {
34 unsafe {
35 ast_expr_visit(
36 node_ref.func as *mut luaur_ast::records::ast_expr::AstExpr,
37 self,
38 );
39 }
40 }
41
42 false
43 }
44}