Skip to main content

luaur_analysis/methods/
internal_error_reporter_ice_error.rs

1use crate::records::internal_compiler_error::InternalCompilerError;
2use crate::records::internal_error_reporter::InternalErrorReporter;
3use luaur_ast::records::location::Location;
4
5impl InternalErrorReporter {
6    pub fn ice_string_location(&self, message: &str, location: &Location) {
7        let error = InternalCompilerError::internal_compiler_error_string_string_location(
8            alloc::string::String::from(message),
9            self.module_name.clone(),
10            *location,
11        );
12
13        if let Some(ref on_internal_error) = self.on_internal_error {
14            let msg = unsafe { core::ffi::CStr::from_ptr(error.what()).to_string_lossy() };
15            on_internal_error(&msg);
16        }
17
18        std::panic::panic_any(error);
19    }
20}