Skip to main content

luaur_analysis/methods/
constraint_solver_block_constraint_solver_alt_c.rs

1use crate::functions::follow_type::follow_type_id;
2use crate::records::constraint::Constraint;
3use crate::records::constraint_solver::ConstraintSolver;
4use crate::type_aliases::type_id::TypeId;
5
6impl ConstraintSolver {
7    pub fn block_type_id_not_null_constraint(
8        &mut self,
9        target: TypeId,
10        constraint: *const Constraint,
11    ) -> bool {
12        let target = unsafe { follow_type_id(target) };
13        let new_block = if luaur_common::FFlag::LuauConstraintGraph.get() {
14            unsafe {
15                (*self.cgraph).add_dependency_of_constraint_vertex_constraint_vertex(
16                    crate::type_aliases::constraint_vertex::ConstraintVertex::V0(target),
17                    crate::type_aliases::constraint_vertex::ConstraintVertex::V2(constraint),
18                )
19            }
20        } else {
21            self.deprecate_d_block(
22                crate::type_aliases::blocked_constraint_id::BlockedConstraintId::V0(target),
23                constraint,
24            )
25        };
26
27        if new_block {
28            if let Some(logger) = unsafe { self.logger.as_mut() } {
29                logger.push_block_not_null_constraint_type_id(constraint, target);
30            }
31        }
32        false
33    }
34}