luaur_analysis/methods/
replacer_ignore_children.rs1use crate::functions::get_type_alt_j::get_type_id;
2use crate::records::extern_type::ExternType;
3use crate::records::function_type::FunctionType;
4use crate::records::replacer::Replacer;
5use crate::type_aliases::type_id::TypeId;
6use crate::type_aliases::type_pack_id::TypePackId;
7use luaur_common::records::dense_hash_map::DenseHashMap;
8
9impl Replacer {
10 pub fn ignore_children(&self, ty: TypeId) -> bool {
11 unsafe {
12 if !get_type_id::<ExternType>(ty).is_null() {
13 return true;
14 }
15
16 if let Some(ftv) = get_type_id::<FunctionType>(ty).as_ref() {
17 if ftv.has_no_free_or_generic_types {
18 return false;
19 }
20
21 for &generic in &ftv.generics {
22 if unsafe { (*self.replacements).find(&generic).is_some() } {
23 return true;
24 }
25 }
26
27 for &generic in &ftv.generic_packs {
28 if unsafe { (*self.replacement_packs).find(&generic).is_some() } {
29 return true;
30 }
31 }
32 }
33 }
34
35 false
36 }
37}