|
@@ -496,7 +496,11 @@ pub fn gen_idl_type(
|
|
use crate::parser::context::CrateContext;
|
|
use crate::parser::context::CrateContext;
|
|
use quote::ToTokens;
|
|
use quote::ToTokens;
|
|
|
|
|
|
- let source_path = proc_macro2::Span::call_site().source_file().path();
|
|
|
|
|
|
+ // If no path was found, just return an empty path and let the find_path function handle it
|
|
|
|
+ let source_path = proc_macro2::Span::call_site()
|
|
|
|
+ .local_file()
|
|
|
|
+ .unwrap_or_default();
|
|
|
|
+
|
|
if let Ok(Ok(ctx)) = find_path("lib.rs", &source_path).map(CrateContext::parse) {
|
|
if let Ok(Ok(ctx)) = find_path("lib.rs", &source_path).map(CrateContext::parse) {
|
|
let name = path.path.segments.last().unwrap().ident.to_string();
|
|
let name = path.path.segments.last().unwrap().ident.to_string();
|
|
let alias = ctx.type_aliases().find(|ty| ty.ident == name);
|
|
let alias = ctx.type_aliases().find(|ty| ty.ident == name);
|