Skip to main content

luaur_analysis/methods/
constraint_generator_report_error.rs

1use crate::records::constraint_generator::ConstraintGenerator;
2use crate::type_aliases::type_error_data::TypeErrorData;
3use luaur_ast::records::location::Location;
4
5impl ConstraintGenerator {
6    pub fn report_error(&mut self, location: Location, err: TypeErrorData) {
7        unsafe {
8            self.errors.push(crate::records::type_error::TypeError {
9                location,
10                module_name: (*self.module.as_ref().unwrap()).name.clone(),
11                data: err.clone(),
12            });
13            if !self.logger.is_null() {
14                (*self.logger).capture_generation_error(self.errors.last().unwrap());
15            }
16        }
17    }
18}