diff options
Diffstat (limited to 'crates/ra_syntax/src/parsing/reparsing.rs')
-rw-r--r-- | crates/ra_syntax/src/parsing/reparsing.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs index 3b6687f61..dc913cf2b 100644 --- a/crates/ra_syntax/src/parsing/reparsing.rs +++ b/crates/ra_syntax/src/parsing/reparsing.rs | |||
@@ -166,9 +166,11 @@ fn merge_errors( | |||
166 | 166 | ||
167 | #[cfg(test)] | 167 | #[cfg(test)] |
168 | mod tests { | 168 | mod tests { |
169 | use std::sync::Arc; | ||
170 | |||
169 | use test_utils::{extract_range, assert_eq_text}; | 171 | use test_utils::{extract_range, assert_eq_text}; |
170 | 172 | ||
171 | use crate::{SourceFile, AstNode}; | 173 | use crate::{SourceFile, AstNode, Parse}; |
172 | use super::*; | 174 | use super::*; |
173 | 175 | ||
174 | fn do_check(before: &str, replace_with: &str, reparsed_len: u32) { | 176 | fn do_check(before: &str, replace_with: &str, reparsed_len: u32) { |
@@ -176,19 +178,19 @@ mod tests { | |||
176 | let edit = AtomTextEdit::replace(range, replace_with.to_owned()); | 178 | let edit = AtomTextEdit::replace(range, replace_with.to_owned()); |
177 | let after = edit.apply(before.clone()); | 179 | let after = edit.apply(before.clone()); |
178 | 180 | ||
179 | let fully_reparsed = SourceFile::parse(&after); | 181 | let fully_reparsed = SourceFile::parse2(&after); |
180 | let incrementally_reparsed = { | 182 | let incrementally_reparsed = { |
181 | let f = SourceFile::parse(&before); | 183 | let f = SourceFile::parse(&before); |
182 | let edit = AtomTextEdit { delete: range, insert: replace_with.to_string() }; | 184 | let edit = AtomTextEdit { delete: range, insert: replace_with.to_string() }; |
183 | let (green, new_errors, range) = | 185 | let (green, new_errors, range) = |
184 | incremental_reparse(f.syntax(), &edit, f.errors()).unwrap(); | 186 | incremental_reparse(f.syntax(), &edit, f.errors()).unwrap(); |
185 | assert_eq!(range.len(), reparsed_len.into(), "reparsed fragment has wrong length"); | 187 | assert_eq!(range.len(), reparsed_len.into(), "reparsed fragment has wrong length"); |
186 | SourceFile::new(green, new_errors) | 188 | Parse { tree: SourceFile::new(green), errors: Arc::new(new_errors) } |
187 | }; | 189 | }; |
188 | 190 | ||
189 | assert_eq_text!( | 191 | assert_eq_text!( |
190 | &fully_reparsed.syntax().debug_dump(), | 192 | &fully_reparsed.tree.syntax().debug_dump(), |
191 | &incrementally_reparsed.syntax().debug_dump(), | 193 | &incrementally_reparsed.tree.syntax().debug_dump(), |
192 | ); | 194 | ); |
193 | } | 195 | } |
194 | 196 | ||