diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-12 17:42:06 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-12 17:42:06 +0100 |
commit | 8bb81d7418dbc4c295d31d261441b67dba4c0f76 (patch) | |
tree | af552549d828905294f4f3c109cdc339c12020ad /crates/ra_hir | |
parent | 2e466bb365813620de15afd5e04736a92fffdca9 (diff) | |
parent | deab4caa7b1ba81c1b7e6561bc270bbde6467f13 (diff) |
Merge #1524
1524: make Parse fields private r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/expr/validation.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/ids.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 4 |
4 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 805357662..4fb5844f4 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -167,7 +167,7 @@ impl ModuleSource { | |||
167 | ) -> ModuleSource { | 167 | ) -> ModuleSource { |
168 | match (file_id, decl_id) { | 168 | match (file_id, decl_id) { |
169 | (Some(file_id), _) => { | 169 | (Some(file_id), _) => { |
170 | let source_file = db.parse(file_id).tree; | 170 | let source_file = db.parse(file_id).tree().to_owned(); |
171 | ModuleSource::SourceFile(source_file) | 171 | ModuleSource::SourceFile(source_file) |
172 | } | 172 | } |
173 | (None, Some(item_id)) => { | 173 | (None, Some(item_id)) => { |
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 4e6131dce..c2a10a0b5 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs | |||
@@ -71,7 +71,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
71 | } | 71 | } |
72 | let source_map = self.func.body_source_map(db); | 72 | let source_map = self.func.body_source_map(db); |
73 | let file_id = self.func.source(db).file_id; | 73 | let file_id = self.func.source(db).file_id; |
74 | let source_file = db.parse(file_id.original_file(db)).tree; | 74 | let parse = db.parse(file_id.original_file(db)); |
75 | let source_file = parse.tree(); | ||
75 | if let Some(field_list_node) = source_map | 76 | if let Some(field_list_node) = source_map |
76 | .expr_syntax(id) | 77 | .expr_syntax(id) |
77 | .map(|ptr| ptr.to_node(source_file.syntax())) | 78 | .map(|ptr| ptr.to_node(source_file.syntax())) |
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 5212b78ac..80e9cccd6 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -60,7 +60,7 @@ impl HirFileId { | |||
60 | file_id: HirFileId, | 60 | file_id: HirFileId, |
61 | ) -> Option<TreeArc<SyntaxNode>> { | 61 | ) -> Option<TreeArc<SyntaxNode>> { |
62 | match file_id.0 { | 62 | match file_id.0 { |
63 | HirFileIdRepr::File(file_id) => Some(db.parse(file_id).tree.syntax().to_owned()), | 63 | HirFileIdRepr::File(file_id) => Some(db.parse(file_id).tree().syntax().to_owned()), |
64 | HirFileIdRepr::Macro(macro_file) => db.parse_macro(macro_file), | 64 | HirFileIdRepr::Macro(macro_file) => db.parse_macro(macro_file), |
65 | } | 65 | } |
66 | } | 66 | } |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 429575fee..573add7da 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -49,8 +49,8 @@ pub fn module_from_declaration( | |||
49 | 49 | ||
50 | /// Locates the module by position in the source code. | 50 | /// Locates the module by position in the source code. |
51 | pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> { | 51 | pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> { |
52 | let file = db.parse(position.file_id).tree; | 52 | let parse = db.parse(position.file_id); |
53 | match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) { | 53 | match find_node_at_offset::<ast::Module>(parse.tree().syntax(), position.offset) { |
54 | Some(m) if !m.has_semi() => module_from_inline(db, position.file_id, m), | 54 | Some(m) if !m.has_semi() => module_from_inline(db, position.file_id, m), |
55 | _ => module_from_file_id(db, position.file_id), | 55 | _ => module_from_file_id(db, position.file_id), |
56 | } | 56 | } |