mirror of
https://github.com/swc-project/swc.git
synced 2025-01-04 11:37:06 +03:00
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:
parent
6dc6d8a847
commit
7a8ad8826a
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_base"
|
name = "swc_ecma_transforms_base"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fxhash = "0.2.1"
|
fxhash = "0.2.1"
|
||||||
|
@ -78,6 +78,7 @@ impl VisitMut for Fixer<'_> {
|
|||||||
node.callee.visit_mut_with(self);
|
node.callee.visit_mut_with(self);
|
||||||
match *node.callee {
|
match *node.callee {
|
||||||
Expr::Call(..)
|
Expr::Call(..)
|
||||||
|
| Expr::Await(..)
|
||||||
| Expr::Bin(..)
|
| Expr::Bin(..)
|
||||||
| Expr::Assign(..)
|
| Expr::Assign(..)
|
||||||
| Expr::Seq(..)
|
| Expr::Seq(..)
|
||||||
@ -1241,4 +1242,9 @@ var store = global[SHARED] || (global[SHARED] = {});
|
|||||||
identical!(new_call, "new (getCtor())");
|
identical!(new_call, "new (getCtor())");
|
||||||
test_fixer!(new_member_1, "new obj.ctor()", "new obj.ctor()");
|
test_fixer!(new_member_1, "new obj.ctor()", "new obj.ctor()");
|
||||||
test_fixer!(new_member_2, "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) }"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user