luaur_analysis/methods/
normalizer_intersect_tables.rs1use crate::records::normalizer::Normalizer;
2use crate::records::type_ids::TypeIds;
3use crate::type_aliases::seen_table_prop_pairs::SeenTablePropPairs;
4use crate::type_aliases::type_id::TypeId;
5use luaur_common::records::dense_hash_set::DenseHashSet;
6
7impl Normalizer {
8 pub fn intersect_tables(&mut self, heres: &mut TypeIds, theres: &TypeIds) {
9 self.consume_fuel();
10
11 let mut tmp = TypeIds::type_ids();
12 for &here in &heres.order {
13 for &there in &theres.order {
14 let mut seen_set_types: DenseHashSet<TypeId> =
15 DenseHashSet::new(core::ptr::null_mut());
16 let mut seen_table_prop_pairs =
17 SeenTablePropPairs::new((core::ptr::null(), core::ptr::null()));
18 if let Some(inter) = self.intersection_of_tables(
19 here,
20 there,
21 &mut seen_table_prop_pairs,
22 &mut seen_set_types,
23 ) {
24 tmp.insert_type_id(inter);
25 }
26 }
27 }
28
29 heres.retain(&tmp);
30 for ty in tmp.order {
31 heres.insert_type_id(ty);
32 }
33 }
34}