Skip to main content

luaur_analysis/functions/
is_generic.rs

1use crate::functions::follow_type::follow_type_id;
2use crate::functions::get_type_alt_j::get_type_id;
3use crate::records::function_type::FunctionType;
4use crate::type_aliases::type_id::TypeId;
5
6pub fn is_generic(ty: TypeId) -> bool {
7    unsafe {
8        let followed = follow_type_id(ty);
9        let ftv = get_type_id::<FunctionType>(followed);
10        if ftv.is_null() {
11            false
12        } else {
13            let ftv_ref = &*ftv;
14            !ftv_ref.generics.is_empty() || !ftv_ref.generic_packs.is_empty()
15        }
16    }
17}