mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
make Parse fields private
this is in preparation for the new rowan API
This commit is contained in:
parent
2e466bb365
commit
deab4caa7b
31 changed files with 109 additions and 99 deletions
|
@ -59,11 +59,19 @@ pub use rowan::{SmolStr, TextRange, TextUnit};
|
|||
/// files.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Parse {
|
||||
pub tree: TreeArc<SourceFile>,
|
||||
pub errors: Arc<Vec<SyntaxError>>,
|
||||
tree: TreeArc<SourceFile>,
|
||||
errors: Arc<Vec<SyntaxError>>,
|
||||
}
|
||||
|
||||
impl Parse {
|
||||
pub fn tree(&self) -> &SourceFile {
|
||||
&*self.tree
|
||||
}
|
||||
|
||||
pub fn errors(&self) -> &[SyntaxError] {
|
||||
&*self.errors
|
||||
}
|
||||
|
||||
pub fn ok(self) -> Result<TreeArc<SourceFile>, Arc<Vec<SyntaxError>>> {
|
||||
if self.errors.is_empty() {
|
||||
Ok(self.tree)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue