diff options
Diffstat (limited to 'crates/ra_syntax/tests')
-rw-r--r-- | crates/ra_syntax/tests/data/parser/fuzz-failures/0000.rs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/crates/ra_syntax/tests/data/parser/fuzz-failures/0000.rs b/crates/ra_syntax/tests/data/parser/fuzz-failures/0000.rs index 53c93d9e9..59cd11495 100644 --- a/crates/ra_syntax/tests/data/parser/fuzz-failures/0000.rs +++ b/crates/ra_syntax/tests/data/parser/fuzz-failures/0000.rs | |||
@@ -10,10 +10,10 @@ | |||
10 | ); | 10 | ); |
11 | File::new(green, errors) | 11 | File::new(green, errors) |
12 | } | 12 | } |
13 | pub fn reparse(&self, edit: &AtomEdit) -> File { | 13 | pub fn reparse(&self, edit: &AtomTextEdit) -> File { |
14 | self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit)) | 14 | self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit)) |
15 | } | 15 | } |
16 | pub fn incremental_reparse(&self, edit: &AtomEdit) -> Option<File> { | 16 | pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option<File> { |
17 | let (node, reparser) = find_reparsable_node(self.syntax(), edit.delete)?; | 17 | let (node, reparser) = find_reparsable_node(self.syntax(), edit.delete)?; |
18 | let text = replace_range( | 18 | let text = replace_range( |
19 | node.text().to_string(), | 19 | node.text().to_string(), |
@@ -31,7 +31,7 @@ | |||
31 | let errors = merge_errors(self.errors(), new_errors, node, edit); | 31 | let errors = merge_errors(self.errors(), new_errors, node, edit); |
32 | Some(File::new(green_root, errors)) | 32 | Some(File::new(green_root, errors)) |
33 | } | 33 | } |
34 | fn full_reparse(&self, edit: &AtomEdit) -> File { | 34 | fn full_reparse(&self, edit: &AtomTextEdit) -> File { |
35 | let text = replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert); | 35 | let text = replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert); |
36 | File::parse(&text) | 36 | File::parse(&text) |
37 | } | 37 | } |
@@ -58,22 +58,22 @@ | |||
58 | } | 58 | } |
59 | 59 | ||
60 | #[derive(Debug, Clone)] | 60 | #[derive(Debug, Clone)] |
61 | pub struct AtomEdit { | 61 | pub struct AtomTextEdit { |
62 | pub delete: TextRange, | 62 | pub delete: TextRange, |
63 | pub insert: String, | 63 | pub insert: String, |
64 | } | 64 | } |
65 | 65 | ||
66 | impl AtomEdit { | 66 | impl AtomTextEdit { |
67 | pub fn replace(range: TextRange, replace_with: String) -> AtomEdit { | 67 | pub fn replace(range: TextRange, replace_with: String) -> AtomTextEdit { |
68 | AtomEdit { delete: range, insert: replace_with } | 68 | AtomTextEdit { delete: range, insert: replace_with } |
69 | } | 69 | } |
70 | 70 | ||
71 | pub fn delete(range: TextRange) -> AtomEdit { | 71 | pub fn delete(range: TextRange) -> AtomTextEdit { |
72 | AtomEdit::replace(range, String::new()) | 72 | AtomTextEdit::replace(range, String::new()) |
73 | } | 73 | } |
74 | 74 | ||
75 | pub fn insert(offset: TextUnit, text: String) -> AtomEdit { | 75 | pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit { |
76 | AtomEdit::replace(TextRange::offset_len(offset, 0.into()), text) | 76 | AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text) |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
@@ -114,17 +114,17 @@ fn is_balanced(tokens: &[Token]) -> bool { | |||
114 | pub insert: String, | 114 | pub insert: String, |
115 | } | 115 | } |
116 | 116 | ||
117 | impl AtomEdit { | 117 | impl AtomTextEdit { |
118 | pub fn replace(range: TextRange, replace_with: String) -> AtomEdit { | 118 | pub fn replace(range: TextRange, replace_with: String) -> AtomTextEdit { |
119 | AtomEdit { delete: range, insert: replace_with } | 119 | AtomTextEdit { delete: range, insert: replace_with } |
120 | } | 120 | } |
121 | 121 | ||
122 | pub fn delete(range: TextRange) -> AtomEdit { | 122 | pub fn delete(range: TextRange) -> AtomTextEdit { |
123 | AtomEdit::replace(range, String::new()) | 123 | AtomTextEdit::replace(range, String::new()) |
124 | } | 124 | } |
125 | 125 | ||
126 | pub fn insert(offset: TextUnit, text: String) -> AtomEdit { | 126 | pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit { |
127 | AtomEdit::replace(TextRange::offset_len(offset, 0.into()), text) | 127 | AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text) |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
@@ -176,7 +176,7 @@ fn merge_errors( | |||
176 | old_errors: Vec<SyntaxError>, | 176 | old_errors: Vec<SyntaxError>, |
177 | new_errors: Vec<SyntaxError>, | 177 | new_errors: Vec<SyntaxError>, |
178 | old_node: SyntaxNodeRef, | 178 | old_node: SyntaxNodeRef, |
179 | edit: &AtomEdit, | 179 | edit: &AtomTextEdit, |
180 | ) -> Vec<SyntaxError> { | 180 | ) -> Vec<SyntaxError> { |
181 | let mut res = Vec::new(); | 181 | let mut res = Vec::new(); |
182 | for e in old_errors { | 182 | for e in old_errors { |