mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
perf(parser): check . before [ in parse_member_expression_rest (#6979)
This commit is contained in:
parent
da199c7476
commit
fa9a4ecd4a
1 changed files with 6 additions and 6 deletions
|
|
@ -635,12 +635,6 @@ impl<'a> ParserImpl<'a> {
|
|||
let mut lhs = lhs;
|
||||
loop {
|
||||
lhs = match self.cur_kind() {
|
||||
// computed member expression is not allowed in decorator
|
||||
// class C { @dec ["1"]() { } }
|
||||
// ^
|
||||
Kind::LBrack if !self.ctx.has_decorator() => {
|
||||
self.parse_computed_member_expression(lhs_span, lhs, false)?
|
||||
}
|
||||
Kind::Dot => self.parse_static_member_expression(lhs_span, lhs, false)?,
|
||||
Kind::QuestionDot => {
|
||||
*in_optional_chain = true;
|
||||
|
|
@ -658,6 +652,12 @@ impl<'a> ParserImpl<'a> {
|
|||
_ => break,
|
||||
}
|
||||
}
|
||||
// computed member expression is not allowed in decorator
|
||||
// class C { @dec ["1"]() { } }
|
||||
// ^
|
||||
Kind::LBrack if !self.ctx.has_decorator() => {
|
||||
self.parse_computed_member_expression(lhs_span, lhs, false)?
|
||||
}
|
||||
Kind::Bang if !self.cur_token().is_on_new_line && self.is_ts => {
|
||||
self.bump_any();
|
||||
self.ast.expression_ts_non_null(self.end_span(lhs_span), lhs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue