summaryrefslogtreecommitdiff
path: root/src/source.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-06-01 13:49:02 +0200
committerLaurenz <laurmaedje@gmail.com>2022-06-01 13:49:02 +0200
commit94b375ce550af1e18942c10c15d92163881a3213 (patch)
treee140d018fd96a01f6407de667df9f08170aaac96 /src/source.rs
parentc56a8c41f0106fcf4bfa55a8b679e4f748b96caa (diff)
Incremental renumbering
Diffstat (limited to 'src/source.rs')
-rw-r--r--src/source.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/source.rs b/src/source.rs
index 87e96297..61abcd92 100644
--- a/src/source.rs
+++ b/src/source.rs
@@ -169,7 +169,7 @@ impl SourceFile {
lines.extend(Line::iter(0, 0, &src));
let mut root = parse(&src);
- root.number(id, Span::MIN_NUMBER);
+ root.numberize(id, Span::FULL).unwrap();
Self {
id,
@@ -243,7 +243,7 @@ impl SourceFile {
self.lines = vec![Line { byte_idx: 0, utf16_idx: 0 }];
self.lines.extend(Line::iter(0, 0, &self.src));
self.root = parse(&self.src);
- self.root.number(self.id(), Span::MIN_NUMBER);
+ self.root.numberize(self.id(), Span::FULL).unwrap();
self.rev = self.rev.wrapping_add(1);
}
@@ -277,9 +277,7 @@ impl SourceFile {
));
// Incrementally reparse the replaced range.
- let range = reparse(&mut self.root, &self.src, replace, with.len());
- self.root.number(self.id(), Span::MIN_NUMBER);
- range
+ reparse(&mut self.root, &self.src, replace, with.len())
}
/// Get the length of the file in bytes.