diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-24 16:07:37 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-24 16:07:37 +0100 |
commit | e9bdb05e9676e85bdd8fa5008e3ada3812b36fd9 (patch) | |
tree | a21d348fbfa2d06f1fba77622c5417383938e6fe /crates/ra_hir_def/src/visibility.rs | |
parent | 1a3b507a007d0373a83bde203d780b860ea55ce1 (diff) | |
parent | 2928600374a8356c2c2bffee080c47cb0f463fb9 (diff) |
Merge #4990
4990: Introduce an ItemTree layer to avoid reparsing files r=matklad a=jonas-schievink
This reduces the latency of "go to definition" in a simple benchmark on rust-analyzer by around 30%.
cc https://github.com/rust-analyzer/rust-analyzer/issues/1650
Closes https://github.com/rust-analyzer/rust-analyzer/issues/3485
Co-authored-by: Aleksey Kladov <[email protected]>
Co-authored-by: Jonas Schievink <[email protected]>
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/visibility.rs')
-rw-r--r-- | crates/ra_hir_def/src/visibility.rs | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/crates/ra_hir_def/src/visibility.rs b/crates/ra_hir_def/src/visibility.rs index 1482d3be0..8136cb50c 100644 --- a/crates/ra_hir_def/src/visibility.rs +++ b/crates/ra_hir_def/src/visibility.rs | |||
@@ -6,7 +6,7 @@ use ra_syntax::ast; | |||
6 | use crate::{ | 6 | use crate::{ |
7 | db::DefDatabase, | 7 | db::DefDatabase, |
8 | path::{ModPath, PathKind}, | 8 | path::{ModPath, PathKind}, |
9 | AssocContainerId, ModuleId, | 9 | ModuleId, |
10 | }; | 10 | }; |
11 | 11 | ||
12 | /// Visibility of an item, not yet resolved. | 12 | /// Visibility of an item, not yet resolved. |
@@ -25,25 +25,6 @@ impl RawVisibility { | |||
25 | RawVisibility::Module(path) | 25 | RawVisibility::Module(path) |
26 | } | 26 | } |
27 | 27 | ||
28 | pub(crate) fn default_for_container(container_id: AssocContainerId) -> Self { | ||
29 | match container_id { | ||
30 | AssocContainerId::TraitId(_) => RawVisibility::Public, | ||
31 | _ => RawVisibility::private(), | ||
32 | } | ||
33 | } | ||
34 | |||
35 | pub(crate) fn from_ast_with_default( | ||
36 | db: &dyn DefDatabase, | ||
37 | default: RawVisibility, | ||
38 | node: InFile<Option<ast::Visibility>>, | ||
39 | ) -> RawVisibility { | ||
40 | Self::from_ast_with_hygiene_and_default( | ||
41 | node.value, | ||
42 | default, | ||
43 | &Hygiene::new(db.upcast(), node.file_id), | ||
44 | ) | ||
45 | } | ||
46 | |||
47 | pub(crate) fn from_ast( | 28 | pub(crate) fn from_ast( |
48 | db: &dyn DefDatabase, | 29 | db: &dyn DefDatabase, |
49 | node: InFile<Option<ast::Visibility>>, | 30 | node: InFile<Option<ast::Visibility>>, |