aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_syntax/src/parser_impl/event.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_syntax/src/parser_impl/event.rs b/crates/ra_syntax/src/parser_impl/event.rs
index 48f37c57c..4e6e25cfb 100644
--- a/crates/ra_syntax/src/parser_impl/event.rs
+++ b/crates/ra_syntax/src/parser_impl/event.rs
@@ -148,14 +148,15 @@ impl<'a, S: Sink> EventProcessor<'a, S> {
148 } 148 }
149 Event::Token { 149 Event::Token {
150 kind, 150 kind,
151 mut n_raw_tokens, 151 n_raw_tokens,
152 } => { 152 } => {
153 self.eat_ws(); 153 self.eat_ws();
154 let mut len = 0.into(); 154 let n_raw_tokens = n_raw_tokens as usize;
155 for _ in 0..n_raw_tokens { 155 let len = self.tokens[self.token_pos..self.token_pos + n_raw_tokens]
156 len += self.tokens[self.token_pos].len; 156 .iter()
157 } 157 .map(|it| it.len)
158 self.leaf(kind, len, n_raw_tokens as usize); 158 .sum::<TextUnit>();
159 self.leaf(kind, len, n_raw_tokens);
159 } 160 }
160 Event::Error { msg } => self.sink.error(msg, self.text_pos), 161 Event::Error { msg } => self.sink.error(msg, self.text_pos),
161 } 162 }