diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-04 10:56:11 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-04 10:56:11 +0000 |
commit | 79d05aacd82dc38f491a87c2f61dc38e8da6e81c (patch) | |
tree | 4dce12051c938fbb5a69c23b5dedea6b0a707aa5 /crates/ra_ide_db/src | |
parent | 437329d3f5b7bb5b703b93c75a97d349eb77d6c7 (diff) | |
parent | 5095573139359ecf4560c66d13278c4122a4ca8b (diff) |
Merge #3438
3438: Remove stray FIXME r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_db/src')
-rw-r--r-- | crates/ra_ide_db/src/defs.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide_db/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_ide_db/src/marks.rs | 9 |
3 files changed, 16 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 | } |
diff --git a/crates/ra_ide_db/src/lib.rs b/crates/ra_ide_db/src/lib.rs index 877ac3c38..aa312c140 100644 --- a/crates/ra_ide_db/src/lib.rs +++ b/crates/ra_ide_db/src/lib.rs | |||
@@ -2,6 +2,7 @@ | |||
2 | //! | 2 | //! |
3 | //! It is mainly a `HirDatabase` for semantic analysis, plus a `SymbolsDatabase`, for fuzzy search. | 3 | //! It is mainly a `HirDatabase` for semantic analysis, plus a `SymbolsDatabase`, for fuzzy search. |
4 | 4 | ||
5 | pub mod marks; | ||
5 | pub mod line_index; | 6 | pub mod line_index; |
6 | pub mod line_index_utils; | 7 | pub mod line_index_utils; |
7 | pub mod feature_flags; | 8 | pub mod feature_flags; |
diff --git a/crates/ra_ide_db/src/marks.rs b/crates/ra_ide_db/src/marks.rs new file mode 100644 index 000000000..d088fa257 --- /dev/null +++ b/crates/ra_ide_db/src/marks.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | //! See test_utils/src/marks.rs | ||
2 | |||
3 | test_utils::marks![ | ||
4 | goto_def_for_macros | ||
5 | goto_def_for_methods | ||
6 | goto_def_for_fields | ||
7 | goto_def_for_record_fields | ||
8 | goto_def_for_field_init_shorthand | ||
9 | ]; | ||