diff options
author | Aleksey Kladov <[email protected]> | 2018-12-27 18:21:10 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-27 18:21:10 +0000 |
commit | e0660506719476a0546e10bee816d7220be85440 (patch) | |
tree | b9b338b6f6eb6332790e01771a0b2bdee13248de /crates/ra_analysis | |
parent | 63f54d234f0d622d043dca8176f0715889a6ed48 (diff) |
use names everywhere
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 38a5c1a7d..0471a2fca 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -243,7 +243,7 @@ impl AnalysisImpl { | |||
243 | rr.add_resolution( | 243 | rr.add_resolution( |
244 | position.file_id, | 244 | position.file_id, |
245 | FileSymbol { | 245 | FileSymbol { |
246 | name: entry.name().clone(), | 246 | name: entry.name().to_string().into(), |
247 | node_range: entry.ptr().range(), | 247 | node_range: entry.ptr().range(), |
248 | kind: NAME, | 248 | kind: NAME, |
249 | }, | 249 | }, |
@@ -261,23 +261,21 @@ impl AnalysisImpl { | |||
261 | let mut rr = ReferenceResolution::new(name.syntax().range()); | 261 | let mut rr = ReferenceResolution::new(name.syntax().range()); |
262 | if let Some(module) = name.syntax().parent().and_then(ast::Module::cast) { | 262 | if let Some(module) = name.syntax().parent().and_then(ast::Module::cast) { |
263 | if module.has_semi() { | 263 | if module.has_semi() { |
264 | let parent_module = | 264 | if let Some(child_module) = |
265 | source_binder::module_from_file_id(&*self.db, position.file_id)?; | 265 | source_binder::module_from_declaration(&*self.db, position.file_id, module)? |
266 | let child_name = module.name(); | 266 | { |
267 | match (parent_module, child_name) { | 267 | let file_id = child_module.source().file_id(); |
268 | (Some(parent_module), Some(child_name)) => { | 268 | let name = match child_module.name() { |
269 | if let Some(child) = parent_module.child(&child_name.text()) { | 269 | Some(name) => name.to_string().into(), |
270 | let file_id = child.source().file_id(); | 270 | None => "".into(), |
271 | let symbol = FileSymbol { | 271 | }; |
272 | name: child_name.text(), | 272 | let symbol = FileSymbol { |
273 | node_range: TextRange::offset_len(0.into(), 0.into()), | 273 | name, |
274 | kind: MODULE, | 274 | node_range: TextRange::offset_len(0.into(), 0.into()), |
275 | }; | 275 | kind: MODULE, |
276 | rr.add_resolution(file_id, symbol); | 276 | }; |
277 | return Ok(Some(rr)); | 277 | rr.add_resolution(file_id, symbol); |
278 | } | 278 | return Ok(Some(rr)); |
279 | } | ||
280 | _ => (), | ||
281 | } | 279 | } |
282 | } | 280 | } |
283 | } | 281 | } |