Skip to content

Commit 2b04efd

Browse files
authored
refactor(es/parser): Remove duplicate check (#10847)
1 parent 44190dd commit 2b04efd

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

.changeset/light-yaks-rule.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_lexer: patch
4+
---
5+
6+
refactor(es/parser): duplicate check

crates/swc_ecma_lexer/src/common/parser/expr.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,14 +2348,6 @@ pub fn parse_primary_expr_rest<'a, P: Parser<'a>>(
23482348
!ctx.contains(Context::InGenerator),
23492349
!ctx.contains(Context::InAsync),
23502350
)?;
2351-
if id.is_reserved_in_strict_mode(
2352-
p.ctx().contains(Context::Module) && !p.ctx().contains(Context::InDeclare),
2353-
) {
2354-
p.emit_strict_mode_err(
2355-
p.input().prev_span(),
2356-
SyntaxError::InvalidIdentInStrict(id.sym.clone()),
2357-
);
2358-
}
23592351

23602352
if can_be_arrow
23612353
&& id.sym == "async"

crates/swc_ecma_lexer/src/common/parser/ident.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,7 @@ pub fn parse_ident<'a>(
216216
word = ident
217217
} else if t.is_yield() && incl_yield {
218218
word = atom!("yield")
219-
} else if t.is_null() || t.is_true() || t.is_false() {
220-
syntax_error!(p, p.input().prev_span(), SyntaxError::ExpectedIdent)
221-
} else if t.is_keyword() {
219+
} else if t.is_null() || t.is_true() || t.is_false() || t.is_keyword() {
222220
syntax_error!(p, p.input().prev_span(), SyntaxError::ExpectedIdent)
223221
} else {
224222
unreachable!()

0 commit comments

Comments
 (0)