Support $crate in item and expr place.

This commit is contained in:
uHOOCCOOHu 2019-09-27 01:59:38 +08:00
parent 8cd23a4fb8
commit 2ecb126f5c
No known key found for this signature in database
GPG key ID: CED392DE0C483D00
14 changed files with 268 additions and 37 deletions

View file

@ -203,6 +203,7 @@ impl SourceAnalyzer {
db: &impl HirDatabase,
macro_call: &ast::MacroCall,
) -> Option<MacroDef> {
// This must be a normal source file rather than macro file.
let path = macro_call.path().and_then(Path::from_ast)?;
self.resolver.resolve_path_as_macro(db, &path)
}
@ -261,6 +262,7 @@ impl SourceAnalyzer {
return Some(PathResolution::AssocItem(assoc));
}
}
// This must be a normal source file rather than macro file.
let hir_path = crate::Path::from_ast(path.clone())?;
self.resolve_hir_path(db, &hir_path)
}