From 87cd57d56aeafa1117a6163249d210f39efe8f28 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 25 Aug 2018 12:10:35 +0300 Subject: Refactor --- crates/libsyntax2/src/yellow/builder.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'crates/libsyntax2/src/yellow/builder.rs') diff --git a/crates/libsyntax2/src/yellow/builder.rs b/crates/libsyntax2/src/yellow/builder.rs index 5e94e5055..e4ab37899 100644 --- a/crates/libsyntax2/src/yellow/builder.rs +++ b/crates/libsyntax2/src/yellow/builder.rs @@ -1,6 +1,6 @@ use { parser_impl::Sink, - yellow::{GreenNode, SyntaxError, SyntaxNode, SyntaxRoot}, + yellow::{GreenNode, SyntaxError}, SyntaxKind, TextRange, TextUnit, }; @@ -13,7 +13,7 @@ pub(crate) struct GreenBuilder<'a> { } impl<'a> Sink<'a> for GreenBuilder<'a> { - type Tree = SyntaxNode; + type Tree = (GreenNode, Vec); fn new(text: &'a str) -> Self { GreenBuilder { @@ -56,10 +56,9 @@ impl<'a> Sink<'a> for GreenBuilder<'a> { }) } - fn finish(mut self) -> SyntaxNode { + fn finish(mut self) -> (GreenNode, Vec) { assert_eq!(self.children.len(), 1); let root = self.children.pop().unwrap(); - let root = SyntaxRoot::new(root, self.errors); - SyntaxNode::new_owned(root) + (root, self.errors) } } -- cgit v1.2.3