diff options
Diffstat (limited to 'crates/ra_ide_db/src/defs.rs')
-rw-r--r-- | crates/ra_ide_db/src/defs.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index f057435bf..97961bb6d 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -14,6 +14,7 @@ use ra_syntax::{ | |||
14 | ast::{self, AstNode, VisibilityOwner}, | 14 | ast::{self, AstNode, VisibilityOwner}, |
15 | match_ast, | 15 | match_ast, |
16 | }; | 16 | }; |
17 | use test_utils::tested_by; | ||
17 | 18 | ||
18 | use crate::RootDatabase; | 19 | use crate::RootDatabase; |
19 | 20 | ||
@@ -217,18 +218,22 @@ pub fn classify_name_ref( | |||
217 | let parent = name_ref.syntax().parent()?; | 218 | let parent = name_ref.syntax().parent()?; |
218 | 219 | ||
219 | if let Some(method_call) = ast::MethodCallExpr::cast(parent.clone()) { | 220 | if let Some(method_call) = ast::MethodCallExpr::cast(parent.clone()) { |
221 | tested_by!(goto_def_for_methods; force); | ||
220 | if let Some(func) = sema.resolve_method_call(&method_call) { | 222 | if let Some(func) = sema.resolve_method_call(&method_call) { |
221 | return Some(NameRefClass::Definition(Definition::ModuleDef(func.into()))); | 223 | return Some(NameRefClass::Definition(Definition::ModuleDef(func.into()))); |
222 | } | 224 | } |
223 | } | 225 | } |
224 | 226 | ||
225 | if let Some(field_expr) = ast::FieldExpr::cast(parent.clone()) { | 227 | if let Some(field_expr) = ast::FieldExpr::cast(parent.clone()) { |
228 | tested_by!(goto_def_for_fields; force); | ||
226 | if let Some(field) = sema.resolve_field(&field_expr) { | 229 | if let Some(field) = sema.resolve_field(&field_expr) { |
227 | return Some(NameRefClass::Definition(Definition::StructField(field))); | 230 | return Some(NameRefClass::Definition(Definition::StructField(field))); |
228 | } | 231 | } |
229 | } | 232 | } |
230 | 233 | ||
231 | if let Some(record_field) = ast::RecordField::cast(parent.clone()) { | 234 | if let Some(record_field) = ast::RecordField::cast(parent.clone()) { |
235 | tested_by!(goto_def_for_record_fields; force); | ||
236 | tested_by!(goto_def_for_field_init_shorthand; force); | ||
232 | if let Some((field, local)) = sema.resolve_record_field(&record_field) { | 237 | if let Some((field, local)) = sema.resolve_record_field(&record_field) { |
233 | let field = Definition::StructField(field); | 238 | let field = Definition::StructField(field); |
234 | let res = match local { | 239 | let res = match local { |
@@ -240,6 +245,7 @@ pub fn classify_name_ref( | |||
240 | } | 245 | } |
241 | 246 | ||
242 | if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { | 247 | if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { |
248 | tested_by!(goto_def_for_macros; force); | ||
243 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { | 249 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { |
244 | return Some(NameRefClass::Definition(Definition::Macro(macro_def))); | 250 | return Some(NameRefClass::Definition(Definition::Macro(macro_def))); |
245 | } | 251 | } |