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_syntax/src | |
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_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 9790a984d..06d3ea727 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -59,11 +59,19 @@ pub use rowan::{SmolStr, TextRange, TextUnit}; | |||
59 | /// files. | 59 | /// files. |
60 | #[derive(Debug, Clone, PartialEq, Eq)] | 60 | #[derive(Debug, Clone, PartialEq, Eq)] |
61 | pub struct Parse { | 61 | pub struct Parse { |
62 | pub tree: TreeArc<SourceFile>, | 62 | tree: TreeArc<SourceFile>, |
63 | pub errors: Arc<Vec<SyntaxError>>, | 63 | errors: Arc<Vec<SyntaxError>>, |
64 | } | 64 | } |
65 | 65 | ||
66 | impl Parse { | 66 | impl Parse { |
67 | pub fn tree(&self) -> &SourceFile { | ||
68 | &*self.tree | ||
69 | } | ||
70 | |||
71 | pub fn errors(&self) -> &[SyntaxError] { | ||
72 | &*self.errors | ||
73 | } | ||
74 | |||
67 | pub fn ok(self) -> Result<TreeArc<SourceFile>, Arc<Vec<SyntaxError>>> { | 75 | pub fn ok(self) -> Result<TreeArc<SourceFile>, Arc<Vec<SyntaxError>>> { |
68 | if self.errors.is_empty() { | 76 | if self.errors.is_empty() { |
69 | Ok(self.tree) | 77 | Ok(self.tree) |