fix(es/transforms): Fix fixer (#1919)

swc_ecma_transforms_base:
 - `fixer`: Allow using await expressions as a callee of a new expression.
This commit is contained in:
강동윤 2021-07-14 22:43:17 +09:00 committed by GitHub
parent 6dc6d8a847
commit 7a8ad8826a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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"

View File

@ -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(..)
@ -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) }"
);
}