Add Ident::is_non_reserved_ident

This commit is contained in:
Michael Goulet
2025-06-26 17:53:01 +00:00
parent 3b9d04c62f
commit 94e9973b92
7 changed files with 14 additions and 15 deletions

View File

@@ -3875,8 +3875,7 @@ impl<'a> Parser<'a> {
// Check if a colon exists one ahead. This means we're parsing a fieldname.
let is_shorthand = !this.look_ahead(1, |t| t == &token::Colon || t == &token::Eq);
// Proactively check whether parsing the field will be incorrect.
let is_wrong = this.token.is_ident()
&& !this.token.is_reserved_ident()
let is_wrong = this.token.is_non_reserved_ident()
&& !this.look_ahead(1, |t| {
t == &token::Colon
|| t == &token::Eq