diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-19 19:18:41 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-19 19:18:41 +0100 |
commit | cd9b222ba0555424d73d549eac43d9aaf1765d7d (patch) | |
tree | 88eea12084b65ba7b0f808cc2c626c7b57c7ac53 /crates/ra_ide_api/src/goto_definition.rs | |
parent | 44bab3621d74f1aec922300a3b3f4476907ba2ac (diff) | |
parent | 2867c40925e8f7b440ff50a421a2d3726b9ff334 (diff) |
Merge #1853
1853: Introduce FromSource trait r=matklad a=viorina
The idea is to provide an ability to get HIR from AST in a more general way than it's possible using `source_binder`.
It also could help with #1622 fixing.
Co-authored-by: Ekaterina Babshukova <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/goto_definition.rs')
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 503dcacff..bc8863dad 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -96,9 +96,8 @@ pub(crate) fn name_definition( | |||
96 | 96 | ||
97 | if let Some(module) = ast::Module::cast(parent.clone()) { | 97 | if let Some(module) = ast::Module::cast(parent.clone()) { |
98 | if module.has_semi() { | 98 | if module.has_semi() { |
99 | if let Some(child_module) = | 99 | let src = hir::Source { file_id: file_id.into(), ast: module }; |
100 | hir::source_binder::module_from_declaration(db, file_id, module) | 100 | if let Some(child_module) = hir::Module::from_declaration(db, src) { |
101 | { | ||
102 | let nav = NavigationTarget::from_module(db, child_module); | 101 | let nav = NavigationTarget::from_module(db, child_module); |
103 | return Some(vec![nav]); | 102 | return Some(vec![nav]); |
104 | } | 103 | } |