aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/reparsing.rs
diff options
context:
space:
mode:
authorAdolfo OchagavĂ­a <[email protected]>2018-11-05 17:38:34 +0000
committerAdolfo OchagavĂ­a <[email protected]>2018-11-05 17:38:34 +0000
commitfda8ddc5fe8a764c0dc91fecb92af1bdf3078485 (patch)
tree1de03cfa42f40bb5ca19956534f53d0b92d271d5 /crates/ra_syntax/src/reparsing.rs
parent3b42ddae601fbd73f672e82028e04c3abdf1252d (diff)
Introduce Location and make SyntaxError fields private
Diffstat (limited to 'crates/ra_syntax/src/reparsing.rs')
-rw-r--r--crates/ra_syntax/src/reparsing.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/crates/ra_syntax/src/reparsing.rs b/crates/ra_syntax/src/reparsing.rs
index 9f5baf1ef..3c4ea5c22 100644
--- a/crates/ra_syntax/src/reparsing.rs
+++ b/crates/ra_syntax/src/reparsing.rs
@@ -165,20 +165,14 @@ fn merge_errors(
165) -> Vec<SyntaxError> { 165) -> Vec<SyntaxError> {
166 let mut res = Vec::new(); 166 let mut res = Vec::new();
167 for e in old_errors { 167 for e in old_errors {
168 if e.range.start() <= old_node.range().start() { 168 if e.offset() <= old_node.range().start() {
169 res.push(e) 169 res.push(e)
170 } else if e.range.start() >= old_node.range().end() { 170 } else if e.offset() >= old_node.range().end() {
171 res.push(SyntaxError { 171 res.push(e.add_offset(TextUnit::of_str(&edit.insert) - edit.delete.len()));
172 kind: e.kind,
173 range: e.range + TextUnit::of_str(&edit.insert) - edit.delete.len(),
174 })
175 } 172 }
176 } 173 }
177 for e in new_errors { 174 for e in new_errors {
178 res.push(SyntaxError { 175 res.push(e.add_offset(old_node.range().start()));
179 kind: e.kind,
180 range: e.range + old_node.range().start(),
181 })
182 } 176 }
183 res 177 res
184} 178}