perf(parser): skip keyword checks for plain identifier expressions (#28371)

Skip keyword validation for plain identifier expressions. Related to
#28303; no added inline annotations.

AI-assisted implementation.
This commit is contained in:
Boshen authored and GitHub committed 2026-10-29 16:30:21 +08:00
1 parent 61303fb376
commit 455fc09fe5
1 file changed
+4
+4
View File
@@ -77,6 +77,10 @@ impl<'a, C: Config> ParserImpl<'a, C> {
/// `PrimaryExpression`: Identifier Reference
pub(crate) fn parse_identifier_expression(&mut self) -> Expression<'a> {
if self.at(Kind::Ident) {
let (span, name) = self.parse_identifier_kind(Kind::Ident);
return Expression::Identifier(IdentifierReference::boxed(span, name, self));
}
let ident = self.parse_identifier_reference();
Expression::Identifier(self.alloc(ident))
}