@@ -6,6 +6,7 @@ use oxc_ecmascript::{
66 side_effects:: is_valid_regexp,
77} ;
88use oxc_semantic:: IsGlobalReference ;
9+ use oxc_span:: GetSpanMut ;
910use oxc_syntax:: scope:: ScopeFlags ;
1011
1112use crate :: { ReusableTraverseCtx , Traverse , TraverseCtx , minifier_traverse:: traverse_mut_with_ctx} ;
@@ -86,7 +87,18 @@ impl<'a> Traverse<'a> for Normalize {
8687
8788 fn exit_expression ( & mut self , expr : & mut Expression < ' a > , ctx : & mut TraverseCtx < ' a > ) {
8889 if let Expression :: ParenthesizedExpression ( paren_expr) = expr {
90+ let outer_start = paren_expr. span . start ;
91+ let is_sequence = matches ! ( & paren_expr. expression, Expression :: SequenceExpression ( _) ) ;
8992 * expr = paren_expr. expression . take_in ( ctx. ast ) ;
93+ // For `SequenceExpression`, the surrounding parens are syntactically required
94+ // when re-emitted in expression context, so any comments attached to the outer
95+ // `(` should remain reachable via the inner expression's span.
96+ if is_sequence {
97+ let span = expr. span_mut ( ) ;
98+ if outer_start < span. start {
99+ span. start = outer_start;
100+ }
101+ }
90102 }
91103 if let Some ( e) = match expr {
92104 Expression :: Identifier ( ident) => Self :: try_compress_identifier ( ident, ctx) ,
0 commit comments