Add an assertion to `NodeRange::new`.

This commit is contained in:
Nicholas Nethercote 2024-08-02 09:39:28 +10:00
parent c8098be41f
commit 5aaa2f92ee
1 changed files with 1 additions and 0 deletions

View File

@ -238,6 +238,7 @@ impl NodeRange {
// is the position of the function's start token. This gives
// `NodeRange(10..15)`.
fn new(ParserRange(parser_range): ParserRange, start_pos: u32) -> NodeRange {
assert!(parser_range.start >= start_pos && parser_range.end >= start_pos);
NodeRange((parser_range.start - start_pos)..(parser_range.end - start_pos))
}
}