Skip to content

Commit 21789c4

Browse files
authored
perf(es/parser): Reduce string comparison (#10355)
1 parent 75a1308 commit 21789c4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/healthy-planes-behave.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
swc_core: patch
3+
swc_ecma_parser: patch
4+
---
5+
6+
perf(es/parser): less str cmp

crates/swc_ecma_parser/src/parser/ident.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ impl<I: Tokens> Parser<I> {
159159
Word::Keyword(Keyword::This) if p.input.syntax().typescript() => Ok(atom!("this")),
160160
Word::Keyword(Keyword::Let) => Ok(atom!("let")),
161161
Word::Ident(ident) => {
162-
if matches!(&ident, IdentLike::Other(arguments) if &**arguments == "arguments")
163-
&& p.ctx().in_class_field
162+
if p.ctx().in_class_field && matches!(&ident, IdentLike::Other(arguments) if atom!("arguments").eq(arguments))
164163
{
165164
p.emit_err(p.input.prev_span(), SyntaxError::ArgumentsInClassField)
166165
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy