Skip to main content

luaur_analysis/methods/
constraint_generator_make_intersect.rs

1use crate::records::constraint_generator::ConstraintGenerator;
2use crate::type_aliases::scope_ptr_type::ScopePtr;
3use crate::type_aliases::type_id::TypeId;
4use luaur_ast::records::location::Location;
5
6impl ConstraintGenerator {
7    pub fn make_intersect(
8        &mut self,
9        scope: &ScopePtr,
10        location: Location,
11        lhs: TypeId,
12        rhs: TypeId,
13    ) -> TypeId {
14        let builtin_types = unsafe { &*self.builtin_types };
15        let intersect_func = &builtin_types.typeFunctions.intersect_func;
16
17        self.create_type_function_instance(
18            intersect_func,
19            alloc::vec![lhs, rhs],
20            alloc::vec![],
21            scope,
22            location,
23        )
24    }
25}