luaur_analysis/functions/
finite.rs1use crate::functions::follow_type_pack::follow_type_pack_id;
5use crate::records::txn_log::TxnLog;
6use crate::records::type_pack::TypePack;
7use crate::records::variadic_type_pack::VariadicTypePack;
8use crate::type_aliases::type_pack_id::TypePackId;
9use crate::type_aliases::type_pack_variant::TypePackVariantMember;
10
11pub fn finite(tp: TypePackId, log: *mut TxnLog) -> bool {
13 unsafe {
14 let tp = if !log.is_null() {
15 (*log).follow_type_pack_id(tp)
16 } else {
17 follow_type_pack_id(tp)
18 };
19
20 if let Some(pack) = TypePack::get_if(&(*tp).ty) {
21 return match pack.tail {
22 Some(tail) => finite(tail, log),
23 None => true,
24 };
25 }
26
27 if VariadicTypePack::get_if(&(*tp).ty).is_some() {
28 return false;
29 }
30
31 true
32 }
33}