Skip to main content

luaur_analysis/methods/
unifier_2_unify_unifier_2_alt_n.rs

1use crate::enums::unify_result::UnifyResult;
2use crate::records::any_type::AnyType;
3use crate::records::table_type::TableType;
4use crate::records::unifier_2::Unifier2;
5
6impl Unifier2 {
7    pub fn unify_table_type_any_type(
8        &mut self,
9        sub_table: &TableType,
10        _super_any: &AnyType,
11    ) -> UnifyResult {
12        for (_prop_name, prop) in &sub_table.props {
13            if let Some(read_ty) = prop.read_ty {
14                let _ = self.unify_type_id_type_id(read_ty, unsafe {
15                    (*self.builtin_types.as_ptr()).anyType
16                });
17            }
18
19            if let Some(write_ty) = prop.write_ty {
20                let _ = self.unify_type_id_type_id(
21                    unsafe { (*self.builtin_types.as_ptr()).anyType },
22                    write_ty,
23                );
24            }
25        }
26
27        if let Some(indexer) = &sub_table.indexer {
28            let _ = self.unify_type_id_type_id(indexer.index_type, unsafe {
29                (*self.builtin_types.as_ptr()).anyType
30            });
31            let _ = self.unify_type_id_type_id(indexer.index_result_type, unsafe {
32                (*self.builtin_types.as_ptr()).anyType
33            });
34        }
35
36        UnifyResult::Ok
37    }
38}