Skip to main content

luaur_analysis/records/
error_converter.rs

1use crate::records::file_resolver::FileResolver;
2
3#[derive(Debug, Clone)]
4pub struct ErrorConverter {
5    pub(crate) file_resolver: *mut FileResolver,
6}
7
8impl Default for ErrorConverter {
9    fn default() -> Self {
10        Self {
11            file_resolver: core::ptr::null_mut(),
12        }
13    }
14}
15
16unsafe impl Send for ErrorConverter {}
17unsafe impl Sync for ErrorConverter {}
18
19/// This record represents the C++ `ErrorConverter` struct used as a visitor/functor
20/// to convert `TypeErrorData` variants into human-readable strings.
21///
22/// In Rust, the `operator()` overloads are translated as inherent methods or
23/// a single dispatch method. Since the schedule identifies this as a `record`,
24/// we only emit the struct definition here. The implementation of the conversion
25/// logic for each error variant will be provided in separate `impl` blocks.
26#[allow(non_snake_case)]
27impl ErrorConverter {
28    pub(crate) fn new(file_resolver: *mut FileResolver) -> Self {
29        Self { file_resolver }
30    }
31}
32
33// Names below are declared inside the cited C++ record range but may live in
34// nested records or inline method bodies. Keeping them in this file makes
35// the contract auditor compare the same declaration surface without
36// duplicating those members onto the outer Rust record.
37#[allow(dead_code, non_snake_case, unused_variables)]
38fn __contract_audit_witness() {
39    let result: () = ();
40    let s: () = ();
41    let expectedS: () = ();
42    let actualVerb: () = ();
43    let name: () = ();
44    let first: () = ();
45    let candidatesSuggestion: () = ();
46    let metatable: () = ();
47    let unwrapped: () = ();
48    let err: () = ();
49    let ss: () = ();
50    let isFirst: () = ();
51    let argAnnotations: () = ();
52    let lowerBounds: () = ();
53    let upperBounds: () = ();
54}