Skip to main content

luaur_analysis/functions/
are_normalized_tables.rs

1use crate::functions::get_type_alt_j::get_type_id;
2use crate::records::metatable_type::MetatableType;
3use crate::records::primitive_type::PrimitiveType;
4use crate::records::table_type::TableType;
5use crate::records::type_ids::TypeIds;
6
7pub fn are_normalized_tables(tys: &TypeIds) -> bool {
8    for ty in tys.order.iter() {
9        unsafe {
10            if !get_type_id::<TableType>(*ty).is_null()
11                || !get_type_id::<MetatableType>(*ty).is_null()
12            {
13                continue;
14            }
15
16            if let Some(pt) = get_type_id::<PrimitiveType>(*ty).as_ref() {
17                if pt.r#type == PrimitiveType::Table {
18                    continue;
19                }
20            }
21
22            return false;
23        }
24    }
25
26    true
27}