Skip to main content

luaur_analysis/methods/
find_expr_or_local_visit_ast_query.rs

1use crate::records::find_expr_or_local::FindExprOrLocal;
2use luaur_ast::records::ast_node::AstNode;
3use luaur_ast::records::ast_stat_block::AstStatBlock;
4use luaur_ast::visit;
5
6impl FindExprOrLocal {
7    pub fn visit_ast_stat_block(&mut self, block: *mut AstStatBlock) -> bool {
8        unsafe {
9            for stat in (*block).body.iter() {
10                let stat = *stat;
11                let stat_node = stat as *mut AstNode;
12                if (*stat_node).location.end <= self.pos {
13                    continue;
14                }
15                if (*stat_node).location.begin > self.pos {
16                    break;
17                }
18
19                visit::ast_stat_visit(stat, self);
20            }
21        }
22
23        false
24    }
25}