aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/libsyntax2/src/lib.rs25
1 files changed, 2 insertions, 23 deletions
diff --git a/crates/libsyntax2/src/lib.rs b/crates/libsyntax2/src/lib.rs
index bae685fb4..d124d3284 100644
--- a/crates/libsyntax2/src/lib.rs
+++ b/crates/libsyntax2/src/lib.rs
@@ -104,29 +104,8 @@ impl File {
104 return None; 104 return None;
105 } 105 }
106 106
107 let reparser: fn(&mut Parser) = if node.kind().is_trivia() { 107 let green = GreenNode::new_leaf(node.kind(), &text);
108 // since trivia is omitted by parser when it doesn't have a parent, \ 108 let new_errors = vec![];
109 // we need to create one for it
110 |p| {
111 p.start().complete(p, ROOT);
112 }
113 } else {
114 |p| {
115 p.bump();
116 }
117 };
118
119 let (green, new_errors) =
120 parser_impl::parse_with::<yellow::GreenBuilder>(
121 &text, &tokens, reparser,
122 );
123
124 let green = if node.kind().is_trivia() {
125 green.children().first().cloned().unwrap()
126 } else {
127 green
128 };
129
130 Some((node, green, new_errors)) 109 Some((node, green, new_errors))
131 }, 110 },
132 _ => None, 111 _ => None,