aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-05-12 20:51:03 +0100
committerAleksey Kladov <[email protected]>2019-05-12 20:51:03 +0100
commit98531dc785535ccde9edc798a17275b9a2f5c1fb (patch)
tree4c481122c2464eb0980ae6ce3e05f3b98236c23f /crates/ra_hir/src
parent0f57564f78207946fdb09e0cddc21a55966b1bc5 (diff)
simplify
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/resolve.rs2
-rw-r--r--crates/ra_hir/src/source_binder.rs13
2 files changed, 7 insertions, 8 deletions
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index 2fb219908..f1c7d7566 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -134,7 +134,7 @@ impl Resolver {
134 resolution 134 resolution
135 } 135 }
136 136
137 pub fn resolve_macro_call( 137 pub(crate) fn resolve_macro_call(
138 &self, 138 &self,
139 db: &impl HirDatabase, 139 db: &impl HirDatabase,
140 path: Option<Path>, 140 path: Option<Path>,
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(