mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
drop errors from SyntaxNode
This commit is contained in:
parent
f52eda675e
commit
90926b9479
2 changed files with 6 additions and 9 deletions
|
@ -74,8 +74,8 @@ impl Parse {
|
||||||
pub use crate::ast::SourceFile;
|
pub use crate::ast::SourceFile;
|
||||||
|
|
||||||
impl SourceFile {
|
impl SourceFile {
|
||||||
fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SourceFile> {
|
fn new(green: GreenNode, _errors: Vec<SyntaxError>) -> TreeArc<SourceFile> {
|
||||||
let root = SyntaxNode::new(green, errors);
|
let root = SyntaxNode::new(green);
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
validation::validate_block_structure(&root);
|
validation::validate_block_structure(&root);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
ops::RangeInclusive,
|
ops::RangeInclusive,
|
||||||
fmt::{self, Write},
|
fmt::{self, Write},
|
||||||
any::Any,
|
|
||||||
borrow::Borrow,
|
borrow::Borrow,
|
||||||
iter::successors,
|
iter::successors,
|
||||||
};
|
};
|
||||||
|
@ -133,10 +132,8 @@ pub enum Direction {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SyntaxNode {
|
impl SyntaxNode {
|
||||||
pub(crate) fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SyntaxNode> {
|
pub(crate) fn new(green: GreenNode) -> TreeArc<SyntaxNode> {
|
||||||
let errors: Option<Box<Any + Send + Sync>> =
|
let ptr = TreeArc(rowan::SyntaxNode::new(green, None));
|
||||||
if errors.is_empty() { None } else { Some(Box::new(errors)) };
|
|
||||||
let ptr = TreeArc(rowan::SyntaxNode::new(green, errors));
|
|
||||||
TreeArc::cast(ptr)
|
TreeArc::cast(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,8 +627,8 @@ impl SyntaxTreeBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn finish(self) -> TreeArc<SyntaxNode> {
|
pub fn finish(self) -> TreeArc<SyntaxNode> {
|
||||||
let (green, errors) = self.finish_raw();
|
let (green, _errors) = self.finish_raw();
|
||||||
let node = SyntaxNode::new(green, errors);
|
let node = SyntaxNode::new(green);
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
crate::validation::validate_block_structure(&node);
|
crate::validation::validate_block_structure(&node);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue