Fix bug in Parser::look_ahead
.
The special case was failing to handle invisible delimiters on one path. Fixes #128895.
This commit is contained in:
parent
fac7753802
commit
46b4c5adc5
3 changed files with 64 additions and 4 deletions
|
@ -1166,10 +1166,12 @@ impl<'a> Parser<'a> {
|
|||
match self.token_cursor.tree_cursor.look_ahead(0) {
|
||||
Some(tree) => {
|
||||
// Indexing stayed within the current token tree.
|
||||
return match tree {
|
||||
TokenTree::Token(token, _) => looker(token),
|
||||
TokenTree::Delimited(dspan, _, delim, _) => {
|
||||
looker(&Token::new(token::OpenDelim(*delim), dspan.open))
|
||||
match tree {
|
||||
TokenTree::Token(token, _) => return looker(token),
|
||||
&TokenTree::Delimited(dspan, _, delim, _) => {
|
||||
if delim != Delimiter::Invisible {
|
||||
return looker(&Token::new(token::OpenDelim(delim), dspan.open));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue