diff --git a/crates/swc/tests/fixture/issues-6xxx/6353/input/.swcrc b/crates/swc/tests/fixture/issues-6xxx/6353/input/.swcrc new file mode 100644 index 000000000000..1d664422ac43 --- /dev/null +++ b/crates/swc/tests/fixture/issues-6xxx/6353/input/.swcrc @@ -0,0 +1,5 @@ +{ + "jsc": { + "target": "es2016" + } +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-6xxx/6353/input/input.js b/crates/swc/tests/fixture/issues-6xxx/6353/input/input.js new file mode 100644 index 000000000000..92a76182f1e9 --- /dev/null +++ b/crates/swc/tests/fixture/issues-6xxx/6353/input/input.js @@ -0,0 +1,8 @@ +(async x => 0).x++; +(async x => 0).x--; + +++(async x => 0).x; +--(async x => 0).x; + + +(async x => 0)`y`; \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-6xxx/6353/output/input.js b/crates/swc/tests/fixture/issues-6xxx/6353/output/input.js new file mode 100644 index 000000000000..f696bee48164 --- /dev/null +++ b/crates/swc/tests/fixture/issues-6xxx/6353/output/input.js @@ -0,0 +1,41 @@ +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +(function() { + var _ref = _async_to_generator(function*(x) { + return 0; + }); + return function(x) { + return _ref.apply(this, arguments); + }; +})().x++; +(function() { + var _ref = _async_to_generator(function*(x) { + return 0; + }); + return function(x) { + return _ref.apply(this, arguments); + }; +})().x--; +++function() { + var _ref = _async_to_generator(function*(x) { + return 0; + }); + return function(x) { + return _ref.apply(this, arguments); + }; +}().x; +--function() { + var _ref = _async_to_generator(function*(x) { + return 0; + }); + return function(x) { + return _ref.apply(this, arguments); + }; +}().x; +(function() { + var _ref = _async_to_generator(function*(x) { + return 0; + }); + return function(x) { + return _ref.apply(this, arguments); + }; +})()`y`; diff --git a/crates/swc_ecma_transforms_base/src/fixer.rs b/crates/swc_ecma_transforms_base/src/fixer.rs index cadae2c0a10d..f06daf330301 100644 --- a/crates/swc_ecma_transforms_base/src/fixer.rs +++ b/crates/swc_ecma_transforms_base/src/fixer.rs @@ -430,7 +430,9 @@ impl VisitMut for Fixer<'_> { | Expr::Bin(_) | Expr::Assign(_) | Expr::Seq(_) - | Expr::Cond(_) => (), + | Expr::Cond(_) + | Expr::TaggedTpl(_) + | Expr::Update(UpdateExpr { prefix: false, .. }) => {} _ => self.ctx = Context::FreeExpr, } }