Make Parser::num_bump_calls 0-indexed.

Currently in `collect_tokens_trailing_token`, `start_pos` and `end_pos`
are 1-indexed by `replace_ranges` is 0-indexed, which is really
confusing. Making them both 0-indexed makes debugging much easier.
This commit is contained in:
Nicholas Nethercote
2024-07-17 17:59:05 +10:00
parent f9c7ca70cb
commit ca6649516f
2 changed files with 11 additions and 6 deletions

View File

@@ -425,6 +425,11 @@ impl<'a> Parser<'a> {
// Make parser point to the first token.
parser.bump();
// Change this from 1 back to 0 after the bump. This eases debugging of
// `Parser::collect_tokens_trailing_token` nicer because it makes the
// token positions 0-indexed which is nicer than 1-indexed.
parser.num_bump_calls = 0;
parser
}