diff options
author | Aleksey Kladov <[email protected]> | 2019-01-26 19:48:04 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-26 19:48:04 +0000 |
commit | 9c1a18a626770b60e8785aa34505dc2caf061c02 (patch) | |
tree | 12ea3ed1983f3ea078890bed666e025fcd1306d1 /crates/ra_hir/src/query_definitions.rs | |
parent | ae97a45c355cbfc0aa61c09ea7cb93373855b9ff (diff) |
store syntax ptr in FileItems
we cache the tree in file_item query anyway
Diffstat (limited to 'crates/ra_hir/src/query_definitions.rs')
-rw-r--r-- | crates/ra_hir/src/query_definitions.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs index 61c93a964..380c06404 100644 --- a/crates/ra_hir/src/query_definitions.rs +++ b/crates/ra_hir/src/query_definitions.rs | |||
@@ -32,9 +32,12 @@ pub(super) fn file_item( | |||
32 | db: &impl HirDatabase, | 32 | db: &impl HirDatabase, |
33 | source_item_id: SourceItemId, | 33 | source_item_id: SourceItemId, |
34 | ) -> TreeArc<SyntaxNode> { | 34 | ) -> TreeArc<SyntaxNode> { |
35 | let source_file = db.hir_parse(source_item_id.file_id); | ||
35 | match source_item_id.item_id { | 36 | match source_item_id.item_id { |
36 | Some(id) => db.file_items(source_item_id.file_id)[id].to_owned(), | 37 | Some(id) => db.file_items(source_item_id.file_id)[id] |
37 | None => db.hir_parse(source_item_id.file_id).syntax().to_owned(), | 38 | .to_node(&source_file) |
39 | .to_owned(), | ||
40 | None => source_file.syntax().to_owned(), | ||
38 | } | 41 | } |
39 | } | 42 | } |
40 | 43 | ||