luaur_analysis/methods/
usage_finder_visit_fragment_autocomplete_alt_h.rs1use crate::records::usage_finder::UsageFinder;
2use luaur_ast::records::ast_expr_global::AstExprGlobal;
3use luaur_ast::records::ast_node::AstNode;
4use luaur_ast::records::ast_stat_function::AstStatFunction;
5use luaur_ast::rtti::ast_node_as;
6
7impl UsageFinder {
8 pub fn visit_ast_stat_function(&mut self, function: *mut AstStatFunction) -> bool {
9 let function_ref = unsafe { &*function };
10
11 let name_expr = function_ref.name;
12 if !name_expr.is_null() {
13 let global = unsafe { ast_node_as::<AstExprGlobal>(name_expr as *mut AstNode) };
14
15 if !global.is_null() {
16 let global_name = unsafe { (*global).name };
17 self.global_functions_referenced.push(global_name);
18 }
19 }
20
21 true
22 }
23}