mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Reuse database in LowerCtx
This commit is contained in:
parent
c4f9cb9b53
commit
20ae41c1a1
7 changed files with 15 additions and 20 deletions
|
@ -204,8 +204,7 @@ impl SourceAnalyzer {
|
|||
macro_call: InFile<&ast::MacroCall>,
|
||||
) -> Option<MacroDef> {
|
||||
let ctx = body::LowerCtx::new(db.upcast(), macro_call.file_id);
|
||||
let path =
|
||||
macro_call.value.path().and_then(|ast| Path::from_src(db.upcast(), ast, &ctx))?;
|
||||
let path = macro_call.value.path().and_then(|ast| Path::from_src(ast, &ctx))?;
|
||||
self.resolver.resolve_path_as_macro(db.upcast(), path.mod_path()).map(|it| it.into())
|
||||
}
|
||||
|
||||
|
@ -285,7 +284,7 @@ impl SourceAnalyzer {
|
|||
// This must be a normal source file rather than macro file.
|
||||
let hygiene = Hygiene::new(db.upcast(), self.file_id);
|
||||
let ctx = body::LowerCtx::with_hygiene(db.upcast(), &hygiene);
|
||||
let hir_path = Path::from_src(db.upcast(), path.clone(), &ctx)?;
|
||||
let hir_path = Path::from_src(path.clone(), &ctx)?;
|
||||
|
||||
// Case where path is a qualifier of another path, e.g. foo::bar::Baz where we
|
||||
// trying to resolve foo::bar.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue