Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(es/transforms/base): Fix await expressions. #2157

Merged
merged 3 commits into from Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ecmascript/transforms/base/Cargo.toml
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.27.0"
version = "0.27.1"

[dependencies]
fxhash = "0.2.1"
Expand Down
16 changes: 15 additions & 1 deletion ecmascript/transforms/base/src/fixer.rs
Expand Up @@ -117,7 +117,11 @@ impl VisitMut for Fixer<'_> {
self.ctx = old;

match &*expr.arg {
Expr::Cond(..) | Expr::Assign(..) => self.wrap(&mut expr.arg),
Expr::Cond(..)
| Expr::Assign(..)
| Expr::Bin(..)
| Expr::Unary(..)
| Expr::Update(..) => self.wrap(&mut expr.arg),
_ => {}
}
}
Expand Down Expand Up @@ -1382,4 +1386,14 @@ var store = global[SHARED] || (global[SHARED] = {});
};
"
);

identical!(
issue_2155,
"
async function main() {
let promise;
await (promise || (promise = Promise.resolve('this is a string')));
}
"
);
}
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@swc/core",
"version": "1.2.82",
"version": "1.2.83",
"description": "Super-fast alternative for babel",
"homepage": "https://swc.rs",
"main": "./index.js",
Expand Down
2 changes: 1 addition & 1 deletion wasm/Cargo.toml
Expand Up @@ -6,7 +6,7 @@ license = "Apache-2.0 AND MIT"
name = "wasm"
publish = false
repository = "https://github.com/swc-project/swc.git"
version = "1.2.82"
version = "1.2.83"

[lib]
crate-type = ["cdylib"]
Expand Down