Skip to content

Commit

Permalink
fix(es/transforms/fixer): Fix await expressions. (#1475)
Browse files Browse the repository at this point in the history
swc_ecma_transforms_base:
 - Handle assign expressions in `await` correctly. (denoland/deno#9810)
  • Loading branch information
kdy1 authored Mar 24, 2021
1 parent fec189f commit df3f310
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
path: |
~/.cargo/
target
key: ${{ runner.os }}-cargo
key: ${{ runner.os }}-cargo-v2
# Ensure that all components are compilable.
- name: Run cargo check for all targets
run: cargo check --color always --all --all-targets
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
path: |
~/.cargo/
target
key: ${{ runner.os }}-cargo
key: ${{ runner.os }}-cargo-v2

- name: Run cargo test
run: |
Expand Down
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.8.0"
version = "0.8.1"

[dependencies]
fxhash = "0.2.1"
Expand Down
4 changes: 3 additions & 1 deletion ecmascript/transforms/base/src/fixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl VisitMut for Fixer<'_> {
self.ctx = old;

match &*expr.arg {
Expr::Cond(..) => self.wrap(&mut expr.arg),
Expr::Cond(..) | Expr::Assign(..) => self.wrap(&mut expr.arg),
_ => {}
}
}
Expand Down Expand Up @@ -1064,4 +1064,6 @@ var store = global[SHARED] || (global[SHARED] = {});
issue_1397,
"const main = async () => await (await server)()"
);

identical!(deno_9810, "await (bar = Promise.resolve(2));");
}

0 comments on commit df3f310

Please sign in to comment.