aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-20 15:00:01 +0000
committerAleksey Kladov <[email protected]>2019-11-20 15:41:23 +0000
commit111891dc2dc1d2c7ea87144e8e3ddefe23fc7b6d (patch)
tree7e96d773620a3b03254d00386711cdc7c909e3ee /crates/ra_hir/src/ty
parentee95a35664e6fe9153f6324cfc57872ca365887c (diff)
Move constants to new ID
This allows us to get rid of trait item index
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/tests.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index abfaffb5e..74c12a0a2 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -11,6 +11,7 @@ use ra_syntax::{
11 ast::{self, AstNode}, 11 ast::{self, AstNode},
12 SyntaxKind::*, 12 SyntaxKind::*,
13}; 13};
14use rustc_hash::FxHashSet;
14use test_utils::covers; 15use test_utils::covers;
15 16
16use crate::{ 17use crate::{
@@ -2518,7 +2519,6 @@ fn test() {
2518 [167; 179) 'GLOBAL_CONST': u32 2519 [167; 179) 'GLOBAL_CONST': u32
2519 [189; 191) 'id': u32 2520 [189; 191) 'id': u32
2520 [194; 210) 'Foo::A..._CONST': u32 2521 [194; 210) 'Foo::A..._CONST': u32
2521 [126; 128) '99': u32
2522 "### 2522 "###
2523 ); 2523 );
2524} 2524}
@@ -4742,10 +4742,13 @@ fn infer(content: &str) -> String {
4742 } 4742 }
4743 }; 4743 };
4744 4744
4745 let mut analyzed = FxHashSet::default();
4745 for node in source_file.syntax().descendants() { 4746 for node in source_file.syntax().descendants() {
4746 if node.kind() == FN_DEF || node.kind() == CONST_DEF || node.kind() == STATIC_DEF { 4747 if node.kind() == FN_DEF || node.kind() == CONST_DEF || node.kind() == STATIC_DEF {
4747 let analyzer = SourceAnalyzer::new(&db, Source::new(file_id.into(), &node), None); 4748 let analyzer = SourceAnalyzer::new(&db, Source::new(file_id.into(), &node), None);
4748 infer_def(analyzer.inference_result(), analyzer.body_source_map()); 4749 if analyzed.insert(analyzer.analyzed_declaration()) {
4750 infer_def(analyzer.inference_result(), analyzer.body_source_map());
4751 }
4749 } 4752 }
4750 } 4753 }
4751 4754