mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
remove some hacks from nameresolution for macros
This commit is contained in:
parent
780e1a365b
commit
caefa6982b
7 changed files with 68 additions and 66 deletions
|
@ -2,11 +2,11 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use either::Either;
|
||||
|
||||
use crate::{
|
||||
ModuleDef, Trait,
|
||||
ModuleDef, Trait, MacroDef,
|
||||
code_model::Crate,
|
||||
MacroDefId,
|
||||
db::HirDatabase,
|
||||
name::{Name, KnownName},
|
||||
nameres::{PerNs, CrateDefMap, CrateModuleId},
|
||||
|
@ -130,13 +130,16 @@ impl Resolver {
|
|||
resolution
|
||||
}
|
||||
|
||||
pub(crate) fn resolve_macro_call(
|
||||
pub(crate) fn resolve_path_as_macro(
|
||||
&self,
|
||||
db: &impl HirDatabase,
|
||||
path: Option<Path>,
|
||||
) -> Option<MacroDefId> {
|
||||
let m = self.module()?;
|
||||
m.0.find_macro(db, m.1, &path?)
|
||||
path: &Path,
|
||||
) -> Option<MacroDef> {
|
||||
let (item_map, module) = self.module()?;
|
||||
match item_map.resolve_path_with_macro(db, module, path) {
|
||||
(Either::Right(macro_def), None) => Some(macro_def),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the resolved path segments
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue