aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/query_definitions.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-18 22:51:34 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-18 22:51:34 +0000
commit0e1c01cdb8e6b346edd5d68d9cc72cbce1ce9793 (patch)
treebba7163aa81ceba1dfb26f481b8fd974421aaa8b /crates/ra_hir/src/query_definitions.rs
parent9664fbcac5e53d725c6e438ffba2194921321b76 (diff)
parent1c5ce7a8682c9e14ce726388b88897644721b19b (diff)
Merge #291
291: File module source does not depend on syntax r=matklad a=matklad Fixes this problem: https://github.com/rust-analyzer/rust-analyzer/pull/289#issuecomment-448398571 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/query_definitions.rs')
-rw-r--r--crates/ra_hir/src/query_definitions.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs
index 37c4f9e4f..efaeb1525 100644
--- a/crates/ra_hir/src/query_definitions.rs
+++ b/crates/ra_hir/src/query_definitions.rs
@@ -38,7 +38,6 @@ pub(super) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc<FnScopes> {
38pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> { 38pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFileItems> {
39 let mut res = SourceFileItems::new(file_id); 39 let mut res = SourceFileItems::new(file_id);
40 let source_file = db.source_file(file_id); 40 let source_file = db.source_file(file_id);
41 res.alloc(source_file.syntax().owned());
42 let source_file = source_file.borrowed(); 41 let source_file = source_file.borrowed();
43 source_file 42 source_file
44 .syntax() 43 .syntax()
@@ -52,7 +51,10 @@ pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc<SourceFi
52} 51}
53 52
54pub(super) fn file_item(db: &impl HirDatabase, source_item_id: SourceItemId) -> SyntaxNode { 53pub(super) fn file_item(db: &impl HirDatabase, source_item_id: SourceItemId) -> SyntaxNode {
55 db.file_items(source_item_id.file_id)[source_item_id.item_id].clone() 54 match source_item_id.item_id {
55 Some(id) => db.file_items(source_item_id.file_id)[id].clone(),
56 None => db.source_file(source_item_id.file_id).syntax().owned(),
57 }
56} 58}
57 59
58pub(crate) fn submodules( 60pub(crate) fn submodules(