diff --git a/crates/oxc_parser/src/js/expression.rs b/crates/oxc_parser/src/js/expression.rs index aca97d9886a59..8aee5438c6551 100644 --- a/crates/oxc_parser/src/js/expression.rs +++ b/crates/oxc_parser/src/js/expression.rs @@ -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)