drop errors from SyntaxNode

This commit is contained in:
Aleksey Kladov 2019-05-05 11:33:07 +03:00
parent f52eda675e
commit 90926b9479
2 changed files with 6 additions and 9 deletions

View file

@ -74,8 +74,8 @@ impl Parse {
pub use crate::ast::SourceFile;
impl SourceFile {
fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SourceFile> {
let root = SyntaxNode::new(green, errors);
fn new(green: GreenNode, _errors: Vec<SyntaxError>) -> TreeArc<SourceFile> {
let root = SyntaxNode::new(green);
if cfg!(debug_assertions) {
validation::validate_block_structure(&root);
}

View file

@ -9,7 +9,6 @@
use std::{
ops::RangeInclusive,
fmt::{self, Write},
any::Any,
borrow::Borrow,
iter::successors,
};
@ -133,10 +132,8 @@ pub enum Direction {
}
impl SyntaxNode {
pub(crate) fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SyntaxNode> {
let errors: Option<Box<Any + Send + Sync>> =
if errors.is_empty() { None } else { Some(Box::new(errors)) };
let ptr = TreeArc(rowan::SyntaxNode::new(green, errors));
pub(crate) fn new(green: GreenNode) -> TreeArc<SyntaxNode> {
let ptr = TreeArc(rowan::SyntaxNode::new(green, None));
TreeArc::cast(ptr)
}
@ -630,8 +627,8 @@ impl SyntaxTreeBuilder {
}
pub fn finish(self) -> TreeArc<SyntaxNode> {
let (green, errors) = self.finish_raw();
let node = SyntaxNode::new(green, errors);
let (green, _errors) = self.finish_raw();
let node = SyntaxNode::new(green);
if cfg!(debug_assertions) {
crate::validation::validate_block_structure(&node);
}