-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/minifier): Keep class with a static block (#8283)
**Related issue:** - Closes #8271.
- Loading branch information
Showing
5 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
crates/swc_ecma_minifier/tests/fixture/issues/8271/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
let $eb2fd35624c84372$var$A = (() => { | ||
let _classDecorators = [$eb2fd35624c84372$var$CustomElement("component-a")]; | ||
let _classDescriptor; | ||
let _classExtraInitializers = []; | ||
let _classThis; | ||
let _classSuper = HTMLElement; | ||
var A = class extends _classSuper { | ||
static { | ||
_classThis = this; | ||
} | ||
static { | ||
console.log(123); | ||
} | ||
constructor() { | ||
super(); | ||
this.innerHTML = "Component A is working"; | ||
} | ||
}; | ||
return (A = _classThis); | ||
})(); | ||
console.log(new $eb2fd35624c84372$var$A().tagName); |
16 changes: 16 additions & 0 deletions
16
crates/swc_ecma_minifier/tests/fixture/issues/8271/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
console.log(new ((()=>{ | ||
let _classThis; | ||
$eb2fd35624c84372$var$CustomElement("component-a"); | ||
let _classSuper = HTMLElement; | ||
return class extends _classSuper { | ||
static{ | ||
_classThis = this; | ||
} | ||
static{ | ||
console.log(123); | ||
} | ||
constructor(){ | ||
super(), this.innerHTML = "Component A is working"; | ||
} | ||
}, _classThis; | ||
})())().tagName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters