bundled translation: Better error reporting

forward the error up the stack instead of panicking while producing the llr
This commit is contained in:
Olivier Goffart 2024-11-19 18:44:09 +01:00
parent 3f8084cdc0
commit 73b549a42c
6 changed files with 21 additions and 13 deletions

View file

@ -415,7 +415,11 @@ pub fn slint(stream: TokenStream) -> TokenStream {
return diag.report_macro_diagnostic(&tokens);
}
let mut result = generator::rust::generate(&root_component, &loader.compiler_config);
let mut result = generator::rust::generate(&root_component, &loader.compiler_config)
.unwrap_or_else(|e| {
let e_str = e.to_string();
quote!(compile_error!(#e_str))
});
// Make sure to recompile if any of the external files changes
let reload = diag