From 78e1ac208217091f47b2292522dc8938b314a094 Mon Sep 17 00:00:00 2001 From: Austaras Date: Thu, 3 Mar 2022 15:30:06 +0800 Subject: [PATCH] class span in block_stmt_or_expr --- .../src/es2022/class_properties/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/swc_ecma_transforms_compat/src/es2022/class_properties/mod.rs b/crates/swc_ecma_transforms_compat/src/es2022/class_properties/mod.rs index e8b948128cdb2..6bd181518076b 100644 --- a/crates/swc_ecma_transforms_compat/src/es2022/class_properties/mod.rs +++ b/crates/swc_ecma_transforms_compat/src/es2022/class_properties/mod.rs @@ -160,8 +160,6 @@ impl VisitMut for ClassProperties { } fn visit_mut_block_stmt_or_expr(&mut self, body: &mut BlockStmtOrExpr) { - let span = body.span(); - match body { BlockStmtOrExpr::Expr(expr) if expr.is_class() => { let ClassExpr { ident, class } = expr.take().class().unwrap(); @@ -177,7 +175,10 @@ impl VisitMut for ClassProperties { arg: Some(Box::new(Expr::Ident(ident))), })); - *body = BlockStmtOrExpr::BlockStmt(BlockStmt { span, stmts }); + *body = BlockStmtOrExpr::BlockStmt(BlockStmt { + span: DUMMY_SP, + stmts, + }); } _ => body.visit_mut_children_with(self), };