Skip to main content

luaur_analysis/methods/
normalizer_intersect_tables_with_table.rs

1use 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_with_table(
9        &mut self,
10        heres: &mut TypeIds,
11        there: TypeId,
12        seen_table_prop_pairs: &mut SeenTablePropPairs,
13        seen_set_types: &mut DenseHashSet<TypeId>,
14    ) {
15        self.consume_fuel();
16
17        let mut tmp = TypeIds::type_ids();
18        let heres_clone = heres.clone();
19        for here in heres_clone.order {
20            if let Some(inter) =
21                self.intersection_of_tables(here, there, seen_table_prop_pairs, seen_set_types)
22            {
23                tmp.insert_type_id(inter);
24            }
25        }
26        heres.retain(&tmp);
27        for ty in tmp.order {
28            heres.insert_type_id(ty);
29        }
30    }
31}