Skip to main content

luaur_analysis/functions/
is_empty.rs

1//! Node: `cxx:Function:Luau.Analysis:Analysis/src/TypePack.cpp:369:is_empty`
2//! Source: `Analysis/src/TypePack.cpp:369-378` (hand-ported)
3
4use crate::functions::follow_type_pack::follow_type_pack_id;
5use crate::records::type_pack::TypePack;
6use crate::type_aliases::type_pack_id::TypePackId;
7use crate::type_aliases::type_pack_variant::TypePackVariantMember;
8
9pub fn is_empty(tp: TypePackId) -> bool {
10    unsafe {
11        let tp = follow_type_pack_id(tp);
12        if let Some(tpp) = TypePack::get_if(&(*tp).ty) {
13            return tpp.head.is_empty()
14                && match tpp.tail {
15                    Some(tail) => is_empty(tail),
16                    None => true,
17                };
18        }
19
20        false
21    }
22}