Skip to content

Commit

Permalink
fix(bundler): Fix inlining pass (#1495)
Browse files Browse the repository at this point in the history
swc_bundler:
 - Fix inlining pass. (denoland/deno#9868)
  • Loading branch information
kdy1 committed Mar 26, 2021
1 parent fa3d65c commit 7853b0a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bundler/Cargo.toml
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.29.1"
version = "0.29.2"

# 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 bundler/src/inline.rs
Expand Up @@ -126,7 +126,7 @@ impl VisitMut for Inliner {
Prop::Shorthand(i) => {
let orig = i.clone();
i.visit_mut_with(self);
if i.span.ctxt != orig.span.ctxt {
if i.span.ctxt == orig.span.ctxt {
return;
}
if i.sym != orig.sym {
Expand Down
5 changes: 5 additions & 0 deletions bundler/tests/fixture/deno-9868/case1/input/entry.ts
@@ -0,0 +1,5 @@
import { foo } from './temp2.ts';

console.log({
foo
});
2 changes: 2 additions & 0 deletions bundler/tests/fixture/deno-9868/case1/input/temp2.ts
@@ -0,0 +1,2 @@
const bar = 1;
export { bar as foo };
3 changes: 3 additions & 0 deletions bundler/tests/fixture/deno-9868/case1/output/entry.inlined.ts
@@ -0,0 +1,3 @@
console.log({
foo: 1
});
4 changes: 4 additions & 0 deletions bundler/tests/fixture/deno-9868/case1/output/entry.ts
@@ -0,0 +1,4 @@
const bar = 1;
console.log({
foo: bar
});

0 comments on commit 7853b0a

Please sign in to comment.