Note: This bug has already been fixed by #9496 , but it hasn't been reported yet.
I'm creating this issue for people who might encounter this problem and search for it.
In short, please upgrade swc to version >= 1.7.23.
When in a subclass constructor, the super call is at the end, and there's a branch that directly returns before the super call, swc emits a _this symbol without any bindings.
Input code
class Test extends Another {
constructor(a, flag) {
if (flag) {
return a()
}
super()
}
}
Config
No response
Playground link (or link to the minimal reproduction)
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
Note: This bug has already been fixed by #9496 , but it hasn't been reported yet. I'm creating this issue for people who might encounter this problem and search for it.
In short, please upgrade swc to version >= 1.7.23.
When in a subclass constructor, the
super
call is at the end, and there's a branch that directly returns before thesuper
call, swc emits a_this
symbol without any bindings.Input code
Config
No response
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.7.22&code=H4sIAAAAAAAAA0XIwQ2AIAxA0TNM0SMkLuEOLtBgURNSTFsSE8PuwsnDP7yfCqrCRmpAjxHvCitXO0ng9S5VVpOWrErABXLBI87vrgzhlxOyJgwY4lAfabtJprrvH6xF1oFjAAAA&config=H4sIAAAAAAAAA12PSw6DMAxE95wCed1tNz1BNz2ElRoU5HxkBwmEuHsDJLRll3ljjydL07YwqIFHu%2BRnFhFFSU6dic4%2B4ZQJkHGoRmxMcKvuoJvVISvtaD0cSIJeuyAuu35krhilp7SH6b2kAIegVFMKoymReOQncSTRi%2Bust93829Kh7%2FkSkrEJLgqp%2FndsSk9w4T3uW%2BX3aY6b2tZc8IPCOWn1VWfPC98aR%2Fb6AXANGa1PAQAA
SWC Info output
No response
Expected behavior
_this
is declared before useActual behavior
Version
1.7.22
Additional context
No response