mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-16 15:14:02 +00:00
commit
b0fe99f02f
1 changed files with 6 additions and 6 deletions
|
@ -75,7 +75,7 @@ pub use smol_str::SmolStr;
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub struct Parse<T> {
|
pub struct Parse<T> {
|
||||||
green: GreenNode,
|
green: GreenNode,
|
||||||
errors: Arc<Vec<SyntaxError>>,
|
errors: Arc<[SyntaxError]>,
|
||||||
_ty: PhantomData<fn() -> T>,
|
_ty: PhantomData<fn() -> T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ impl<T> Clone for Parse<T> {
|
||||||
|
|
||||||
impl<T> Parse<T> {
|
impl<T> Parse<T> {
|
||||||
fn new(green: GreenNode, errors: Vec<SyntaxError>) -> Parse<T> {
|
fn new(green: GreenNode, errors: Vec<SyntaxError>) -> Parse<T> {
|
||||||
Parse { green, errors: Arc::new(errors), _ty: PhantomData }
|
Parse { green, errors: errors.into(), _ty: PhantomData }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn syntax_node(&self) -> SyntaxNode {
|
pub fn syntax_node(&self) -> SyntaxNode {
|
||||||
|
@ -107,7 +107,7 @@ impl<T: AstNode> Parse<T> {
|
||||||
T::cast(self.syntax_node()).unwrap()
|
T::cast(self.syntax_node()).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ok(self) -> Result<T, Arc<Vec<SyntaxError>>> {
|
pub fn ok(self) -> Result<T, Arc<[SyntaxError]>> {
|
||||||
if self.errors.is_empty() {
|
if self.errors.is_empty() {
|
||||||
Ok(self.tree())
|
Ok(self.tree())
|
||||||
} else {
|
} else {
|
||||||
|
@ -144,7 +144,7 @@ impl Parse<SourceFile> {
|
||||||
parsing::incremental_reparse(self.tree().syntax(), indel, self.errors.to_vec()).map(
|
parsing::incremental_reparse(self.tree().syntax(), indel, self.errors.to_vec()).map(
|
||||||
|(green_node, errors, _reparsed_range)| Parse {
|
|(green_node, errors, _reparsed_range)| Parse {
|
||||||
green: green_node,
|
green: green_node,
|
||||||
errors: Arc::new(errors),
|
errors: errors.into(),
|
||||||
_ty: PhantomData,
|
_ty: PhantomData,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -168,7 +168,7 @@ impl SourceFile {
|
||||||
errors.extend(validation::validate(&root));
|
errors.extend(validation::validate(&root));
|
||||||
|
|
||||||
assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
|
assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
|
||||||
Parse { green, errors: Arc::new(errors), _ty: PhantomData }
|
Parse { green, errors: errors.into(), _ty: PhantomData }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ impl ast::TokenTree {
|
||||||
|
|
||||||
let (green, errors) = builder.finish_raw();
|
let (green, errors) = builder.finish_raw();
|
||||||
|
|
||||||
Parse { green, errors: Arc::new(errors), _ty: PhantomData }
|
Parse { green, errors: errors.into(), _ty: PhantomData }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue