aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_binder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r--crates/ra_hir/src/source_binder.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 31bf13425..bb485e35f 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -20,7 +20,7 @@ use crate::{
20 HirDatabase, Function, Struct, Enum, Const, Static, Either, DefWithBody, PerNs, Name, 20 HirDatabase, Function, Struct, Enum, Const, Static, Either, DefWithBody, PerNs, Name,
21 AsName, Module, HirFileId, Crate, Trait, Resolver, Ty,Path, 21 AsName, Module, HirFileId, Crate, Trait, Resolver, Ty,Path,
22 expr::{BodySourceMap, scope::{ScopeId, ExprScopes}}, 22 expr::{BodySourceMap, scope::{ScopeId, ExprScopes}},
23 ids::{LocationCtx,MacroCallId}, 23 ids::{LocationCtx, MacroDefId},
24 docs::{docs_from_ast,Documentation}, 24 docs::{docs_from_ast,Documentation},
25 expr, AstId, 25 expr, AstId,
26}; 26};
@@ -191,13 +191,12 @@ pub enum PathResolution {
191 191
192#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 192#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
193pub struct MacroByExampleDef { 193pub struct MacroByExampleDef {
194 pub(crate) id: MacroCallId, 194 pub(crate) id: MacroDefId,
195} 195}
196 196
197impl MacroByExampleDef { 197impl MacroByExampleDef {
198 pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::MacroCall>) { 198 pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::MacroCall>) {
199 let loc = self.id.loc(db); 199 (self.id.0.file_id(), self.id.0.to_node(db))
200 (self.id.into(), loc.def.0.to_node(db))
201 } 200 }
202} 201}
203 202
@@ -296,9 +295,9 @@ impl SourceAnalyzer {
296 db, 295 db,
297 macro_call.path().and_then(Path::from_ast), 296 macro_call.path().and_then(Path::from_ast),
298 ast_id, 297 ast_id,
299 ); 298 )?;
300 299 let loc = call_id.loc(db);
301 call_id.map(|id| MacroByExampleDef { id }) 300 Some(MacroByExampleDef { id: loc.def })
302 } 301 }
303 302
304 pub fn resolve_hir_path( 303 pub fn resolve_hir_path(