diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-08-29 17:35:35 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-08-29 17:35:35 +0200 |
| commit | a71a2057f286677b5bf2e064fea05024aeca0dd2 (patch) | |
| tree | 716d85481aca232abdb6c2e01a0a545c003f4c6b /crates/typst-syntax/src/reparser.rs | |
| parent | 7bdf1f57b09ea605045254013a8200373451baf0 (diff) | |
More type safety for spans
Diffstat (limited to 'crates/typst-syntax/src/reparser.rs')
| -rw-r--r-- | crates/typst-syntax/src/reparser.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/typst-syntax/src/reparser.rs b/crates/typst-syntax/src/reparser.rs index a4186fa7..e03e1619 100644 --- a/crates/typst-syntax/src/reparser.rs +++ b/crates/typst-syntax/src/reparser.rs @@ -21,7 +21,9 @@ pub fn reparse( try_reparse(text, replaced, replacement_len, None, root, 0).unwrap_or_else(|| { let id = root.span().id(); *root = parse(text); - root.numberize(id, Span::FULL).unwrap(); + if let Some(id) = id { + root.numberize(id, Span::FULL).unwrap(); + } 0..text.len() }) } |
