aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/resolve.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/resolve.rs')
-rw-r--r--crates/ra_hir/src/resolve.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index d6956f45e..1b987c1b6 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -2,11 +2,11 @@
2use std::sync::Arc; 2use std::sync::Arc;
3 3
4use rustc_hash::{FxHashMap, FxHashSet}; 4use rustc_hash::{FxHashMap, FxHashSet};
5use either::Either;
5 6
6use crate::{ 7use crate::{
7 ModuleDef, Trait, 8 ModuleDef, Trait, MacroDef,
8 code_model::Crate, 9 code_model::Crate,
9 MacroDefId,
10 db::HirDatabase, 10 db::HirDatabase,
11 name::{Name, KnownName}, 11 name::{Name, KnownName},
12 nameres::{PerNs, CrateDefMap, CrateModuleId}, 12 nameres::{PerNs, CrateDefMap, CrateModuleId},
@@ -130,13 +130,16 @@ impl Resolver {
130 resolution 130 resolution
131 } 131 }
132 132
133 pub(crate) fn resolve_macro_call( 133 pub(crate) fn resolve_path_as_macro(
134 &self, 134 &self,
135 db: &impl HirDatabase, 135 db: &impl HirDatabase,
136 path: Option<Path>, 136 path: &Path,
137 ) -> Option<MacroDefId> { 137 ) -> Option<MacroDef> {
138 let m = self.module()?; 138 let (item_map, module) = self.module()?;
139 m.0.find_macro(db, m.1, &path?) 139 match item_map.resolve_path_with_macro(db, module, path) {
140 (Either::Right(macro_def), None) => Some(macro_def),
141 _ => None,
142 }
140 } 143 }
141 144
142 /// Returns the resolved path segments 145 /// Returns the resolved path segments
@@ -165,7 +168,11 @@ impl Resolver {
165 168
166 /// Returns the fully resolved path if we were able to resolve it. 169 /// Returns the fully resolved path if we were able to resolve it.
167 /// otherwise returns `PerNs::none` 170 /// otherwise returns `PerNs::none`
168 pub(crate) fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> PerNs<Resolution> { 171 pub(crate) fn resolve_path_without_assoc_items(
172 &self,
173 db: &impl HirDatabase,
174 path: &Path,
175 ) -> PerNs<Resolution> {
169 // into_fully_resolved() returns the fully resolved path or PerNs::none() otherwise 176 // into_fully_resolved() returns the fully resolved path or PerNs::none() otherwise
170 self.resolve_path_segments(db, path).into_fully_resolved() 177 self.resolve_path_segments(db, path).into_fully_resolved()
171 } 178 }