Skip to content

Commit

Permalink
fix(es): Fix bugs (#1709)
Browse files Browse the repository at this point in the history
swc_ecma_transforms_base:
 - `fixer`: Fix regression related to `??` and `||`. (denoland/deno#10668)
  • Loading branch information
kdy1 authored May 18, 2021
1 parent 57d1aaf commit dee8290
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bundler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"]
license = "Apache-2.0/MIT"
name = "swc_bundler"
repository = "https://github.com/swc-project/swc.git"
version = "0.37.0"
version = "0.37.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
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.15.1"
version = "0.15.2"

[dependencies]
fxhash = "0.2.1"
Expand Down
8 changes: 7 additions & 1 deletion ecmascript/transforms/base/src/fixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ impl VisitMut for Fixer<'_> {
self.wrap(&mut expr.right);
}
}
} else if op_of_rhs.precedence() <= expr.op.precedence() {
} else if op_of_rhs.precedence() <= expr.op.precedence()
|| (*op_of_rhs == op!("&&") && expr.op == op!("??"))
{
self.wrap(&mut expr.right);
}
}
Expand Down Expand Up @@ -1184,4 +1186,8 @@ var store = global[SHARED] || (global[SHARED] = {});
deno_10487_2,
"class MultiVector extends (options.baseType||Float32Array) {}"
);

identical!(deno_10668_1, "console.log(null ?? (undefined && true))");

identical!(deno_10668_2, "console.log(null && (undefined ?? true))");
}

0 comments on commit dee8290

Please sign in to comment.