Skip to main content

luaur_analysis/methods/
usage_finder_visit_fragment_autocomplete_alt_e.rs

1use crate::records::usage_finder::UsageFinder;
2use luaur_ast::records::ast_type_reference::AstTypeReference;
3
4impl UsageFinder {
5    pub fn visit_ast_type_reference(&mut self, ref_: *mut AstTypeReference) -> bool {
6        let ref_ = unsafe { &*ref_ };
7        if let Some(prefix) = ref_.prefix {
8            let prefix_value = unsafe {
9                core::ffi::CStr::from_ptr(prefix.value)
10                    .to_string_lossy()
11                    .into_owned()
12            };
13            let name_value = unsafe {
14                core::ffi::CStr::from_ptr(ref_.name.value)
15                    .to_string_lossy()
16                    .into_owned()
17            };
18            self.referenced_imported_bindings
19                .push((prefix_value, name_value));
20        } else {
21            let name_value = unsafe {
22                core::ffi::CStr::from_ptr(ref_.name.value)
23                    .to_string_lossy()
24                    .into_owned()
25            };
26            self.referenced_bindings.push(name_value);
27        }
28        true
29    }
30}