aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/yellow/builder.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-25 10:10:35 +0100
committerAleksey Kladov <[email protected]>2018-08-25 10:10:35 +0100
commit87cd57d56aeafa1117a6163249d210f39efe8f28 (patch)
treea917b4bff6164902d26ed5334f94c6e76745bfbc /crates/libsyntax2/src/yellow/builder.rs
parenta44428fc796cb5afb5b85cd246974e590eef2040 (diff)
Refactor
Diffstat (limited to 'crates/libsyntax2/src/yellow/builder.rs')
-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}