aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/yellow
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src/yellow')
-rw-r--r--crates/libsyntax2/src/yellow/builder.rs9
1 files changed, 4 insertions, 5 deletions
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 @@
1use { 1use {
2 parser_impl::Sink, 2 parser_impl::Sink,
3 yellow::{GreenNode, SyntaxError, SyntaxNode, SyntaxRoot}, 3 yellow::{GreenNode, SyntaxError},
4 SyntaxKind, TextRange, TextUnit, 4 SyntaxKind, TextRange, TextUnit,
5}; 5};
6 6
@@ -13,7 +13,7 @@ pub(crate) struct GreenBuilder<'a> {
13} 13}
14 14
15impl<'a> Sink<'a> for GreenBuilder<'a> { 15impl<'a> Sink<'a> for GreenBuilder<'a> {
16 type Tree = SyntaxNode; 16 type Tree = (GreenNode, Vec<SyntaxError>);
17 17
18 fn new(text: &'a str) -> Self { 18 fn new(text: &'a str) -> Self {
19 GreenBuilder { 19 GreenBuilder {
@@ -56,10 +56,9 @@ impl<'a> Sink<'a> for GreenBuilder<'a> {
56 }) 56 })
57 } 57 }
58 58
59 fn finish(mut self) -> SyntaxNode { 59 fn finish(mut self) -> (GreenNode, Vec<SyntaxError>) {
60 assert_eq!(self.children.len(), 1); 60 assert_eq!(self.children.len(), 1);
61 let root = self.children.pop().unwrap(); 61 let root = self.children.pop().unwrap();
62 let root = SyntaxRoot::new(root, self.errors); 62 (root, self.errors)
63 SyntaxNode::new_owned(root)
64 } 63 }
65} 64}