Skip to content

Commit

Permalink
fix(es/transforms): Fix fixer (#1919)
Browse files Browse the repository at this point in the history
swc_ecma_transforms_base:
 - `fixer`: Allow using await expressions as a callee of a new expression.
  • Loading branch information
kdy1 committed Jul 14, 2021
1 parent 6dc6d8a commit 7a8ad88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ecmascript/transforms/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_base"
repository = "https://github.com/swc-project/swc.git"
version = "0.22.0"
version = "0.22.1"

[dependencies]
fxhash = "0.2.1"
Expand Down
6 changes: 6 additions & 0 deletions ecmascript/transforms/base/src/fixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl VisitMut for Fixer<'_> {
node.callee.visit_mut_with(self);
match *node.callee {
Expr::Call(..)
| Expr::Await(..)
| Expr::Bin(..)
| Expr::Assign(..)
| Expr::Seq(..)
Expand Down Expand Up @@ -1241,4 +1242,9 @@ var store = global[SHARED] || (global[SHARED] = {});
identical!(new_call, "new (getCtor())");
test_fixer!(new_member_1, "new obj.ctor()", "new obj.ctor()");
test_fixer!(new_member_2, "new (obj.ctor)", "new obj.ctor");

identical!(
new_await_1,
"async function foo() { new (await getServerImpl())(options) }"
);
}

0 comments on commit 7a8ad88

Please sign in to comment.