aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/resolve.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-05-12 21:05:45 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-05-12 21:05:45 +0100
commitb22614f0b500c351d3abf33a4ed6beaea6861bca (patch)
tree8e6cd37bc459cdb9444d482f74aa2455d06499b1 /crates/ra_hir/src/resolve.rs
parent0f57564f78207946fdb09e0cddc21a55966b1bc5 (diff)
parent9cba67b2ad0ef43b5c405f21f516c9ebee63a932 (diff)
Merge #1268
1268: simplify r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/resolve.rs')
-rw-r--r--crates/ra_hir/src/resolve.rs17
1 files changed, 3 insertions, 14 deletions
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index 2fb219908..3874e28bf 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -1,16 +1,12 @@
1//! Name resolution. 1//! Name resolution.
2use std::sync::Arc; 2use std::sync::Arc;
3 3
4use ra_syntax::ast;
5
6use rustc_hash::{FxHashMap, FxHashSet}; 4use rustc_hash::{FxHashMap, FxHashSet};
7 5
8use crate::{ 6use crate::{
9 ModuleDef, Trait, 7 ModuleDef, Trait,
10 code_model_api::Crate, 8 code_model_api::Crate,
11 MacroCallId, 9 MacroDefId,
12 MacroCallLoc,
13 AstId,
14 db::HirDatabase, 10 db::HirDatabase,
15 name::{Name, KnownName}, 11 name::{Name, KnownName},
16 nameres::{PerNs, CrateDefMap, CrateModuleId}, 12 nameres::{PerNs, CrateDefMap, CrateModuleId},
@@ -134,16 +130,9 @@ impl Resolver {
134 resolution 130 resolution
135 } 131 }
136 132
137 pub fn resolve_macro_call( 133 pub(crate) fn resolve_macro_call(&self, path: Option<Path>) -> Option<MacroDefId> {
138 &self,
139 db: &impl HirDatabase,
140 path: Option<Path>,
141 ast_id: AstId<ast::MacroCall>,
142 ) -> Option<MacroCallId> {
143 let name = path.and_then(|path| path.expand_macro_expr()).unwrap_or_else(Name::missing); 134 let name = path.and_then(|path| path.expand_macro_expr()).unwrap_or_else(Name::missing);
144 let def_id = self.module().and_then(|(module, _)| module.find_macro(&name))?; 135 self.module()?.0.find_macro(&name)
145 let call_loc = MacroCallLoc { def: *def_id, ast_id }.id(db);
146 Some(call_loc)
147 } 136 }
148 137
149 /// Returns the resolved path segments 138 /// Returns the resolved path segments