Skip to main content

luaur_analysis/functions/
simplify_intersection_simplify.rs

1use crate::records::builtin_types::BuiltinTypes;
2use crate::records::simplify_result::SimplifyResult;
3use crate::records::type_arena::TypeArena;
4use crate::records::type_simplifier::TypeSimplifier;
5use crate::type_aliases::type_id::TypeId;
6use luaur_common::records::dense_hash_set::DenseHashSet;
7
8pub fn simplify_intersection(
9    builtin_types: *mut BuiltinTypes,
10    arena: *mut TypeArena,
11    left: TypeId,
12    right: TypeId,
13) -> SimplifyResult {
14    let mut s = TypeSimplifier {
15        builtin_types: builtin_types as *const BuiltinTypes,
16        arena: arena as *const TypeArena,
17        blocked_types: DenseHashSet::new(core::ptr::null_mut()),
18        recursion_depth: 0,
19    };
20
21    let res = s.intersect(left, right);
22
23    SimplifyResult {
24        result: res,
25        blocked_types: s.blocked_types,
26    }
27}