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

+6
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

+1-2
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)