diff --git a/crates/swc/tests/fixture/issues-8xxx/8095/es2020/output/1.js b/crates/swc/tests/fixture/issues-8xxx/8095/es2020/output/1.js index 1c7b365ed12d..11ff4d3b6363 100644 --- a/crates/swc/tests/fixture/issues-8xxx/8095/es2020/output/1.js +++ b/crates/swc/tests/fixture/issues-8xxx/8095/es2020/output/1.js @@ -6,4 +6,4 @@ const foo = (_class = class _class { } }, _ts_decorate([ foo -], _class.prototype, "foo", null)); +], _class.prototype, "foo", null), _class); diff --git a/crates/swc/tests/fixture/issues-8xxx/8095/es2022/output/1.js b/crates/swc/tests/fixture/issues-8xxx/8095/es2022/output/1.js index 1c7b365ed12d..11ff4d3b6363 100644 --- a/crates/swc/tests/fixture/issues-8xxx/8095/es2022/output/1.js +++ b/crates/swc/tests/fixture/issues-8xxx/8095/es2022/output/1.js @@ -6,4 +6,4 @@ const foo = (_class = class _class { } }, _ts_decorate([ foo -], _class.prototype, "foo", null)); +], _class.prototype, "foo", null), _class); diff --git a/crates/swc/tests/fixture/issues-8xxx/8095/es5/output/1.js b/crates/swc/tests/fixture/issues-8xxx/8095/es5/output/1.js index d45df706522e..ffcf70998bfa 100644 --- a/crates/swc/tests/fixture/issues-8xxx/8095/es5/output/1.js +++ b/crates/swc/tests/fixture/issues-8xxx/8095/es5/output/1.js @@ -18,4 +18,4 @@ var foo = (_class = function() { return _class; }(), _ts_decorate([ foo -], _class.prototype, "foo", null)); +], _class.prototype, "foo", null), _class); diff --git a/crates/swc/tests/fixture/issues-8xxx/8515/output/index.js b/crates/swc/tests/fixture/issues-8xxx/8515/output/index.js index 4fe14acf27c8..e5366f6d0261 100644 --- a/crates/swc/tests/fixture/issues-8xxx/8515/output/index.js +++ b/crates/swc/tests/fixture/issues-8xxx/8515/output/index.js @@ -5,7 +5,7 @@ var C = (_class = class _class extends Component { }, _class = _ts_decorate([ addX, addY -], _class)); +], _class), _class); let OtherClass = class OtherClass extends Component { }; OtherClass = _ts_decorate([ diff --git a/crates/swc_ecma_transforms_proposal/src/decorators/legacy/mod.rs b/crates/swc_ecma_transforms_proposal/src/decorators/legacy/mod.rs index e27e3e553ef6..55d0a9fdcc15 100644 --- a/crates/swc_ecma_transforms_proposal/src/decorators/legacy/mod.rs +++ b/crates/swc_ecma_transforms_proposal/src/decorators/legacy/mod.rs @@ -285,11 +285,12 @@ impl VisitMut for TscDecorator { exprs: iter::once(AssignExpr { span: DUMMY_SP, op: op!("="), - left: var_name.into(), + left: var_name.clone().into(), right: Box::new(e.take()), }) .map(Into::into) .chain(appended_exprs) + .chain(iter::once(var_name.into())) .collect(), }); }