Skip to main content

luaur_analysis/methods/
constraint_solver_report_error_constraint_solver.rs

1use crate::records::constraint_solver::ConstraintSolver;
2use crate::records::type_error::TypeError;
3use crate::type_aliases::type_error_data::TypeErrorData;
4use luaur_ast::records::location::Location;
5
6impl ConstraintSolver {
7    pub fn report_error_type_error_data_location(
8        &mut self,
9        data: TypeErrorData,
10        location: &Location,
11    ) {
12        self.errors
13            .push(TypeError::type_error_location_type_error_data(
14                *location, data,
15            ));
16        if let Some(ref module) = self.module {
17            let name = module.name.clone();
18            if let Some(last) = self.errors.last_mut() {
19                last.module_name = name;
20            }
21        }
22    }
23}