[pseudo] Fix an invalid assertion on recoveryBrackets.

The `Begin` is not the index of the left bracket, `Begin-1` is,
otherwise the assertion will be triggered on case `Foo().call();`.
This commit is contained in:
Haojian Wu 2022-07-21 13:57:33 +02:00
parent ce824078de
commit 65c8e24622
1 changed files with 1 additions and 1 deletions

View File

@ -124,7 +124,7 @@ Token::Index recoverBrackets(Token::Index Begin, const TokenStream &Tokens) {
assert(Left.Kind == tok::l_brace || Left.Kind == tok::l_paren ||
Left.Kind == tok::l_square);
if (const Token *Right = Left.pair()) {
assert(Tokens.index(*Right) > Begin);
assert(Tokens.index(*Right) > Begin - 1);
return Tokens.index(*Right);
}
return Token::Invalid;