When SWC adds a super(...args) call, it doesn't sourcemap it back to original code. Since super(...args) could throw, resulting stacks would not be sourcemapped fully.
Input code
class Parent {
constructor() {
throw new Error('foo')
}
}
class Child extends Parent {
handleScroll = () => {}
}
new Child()
Describe the bug
When SWC adds a
super(...args)
call, it doesn't sourcemap it back to original code. Sincesuper(...args)
could throw, resulting stacks would not be sourcemapped fully.Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.9.2&code=H4sIAAAAAAAAA1WMQQqEMAxF9z1FdtpD6GZwL8wJSpqhAyGBNIOCeHdrcTNv%2BT%2FvIadaYU1G4nAEaKBKdfuhq43x2W68mG4gtMFi1r7hozrEfp%2FhDAF76lW%2BnIF2J8l%2F4ZIkM73RlBkmaOlphqObd7N7Y7wAs2IpXpAAAAA%3D&config=H4sIAAAAAAAAA1WOTQ7CIBBG95yCzNq1MSZ6Aw9B6LSh4S8MNZKmdy9FwLqb%2BR7z%2BFbGOcwk4c7XPObFi0AY%2Bp4TSjaKT04ApREkg%2FIRLo3OdKBRaMISbV8C2jnCTGJYsEZGWTWms1o64wMSNUO3GmEnjf9iVuVg3LAUWCvH5LHUoyv8HrXPuhgUvdplawVo3yeRCBPGow1YNyB%2FPvitGNm2A%2FOWcNspAQAA
SWC Info output
No response
Expected behavior
Transpiled code produces stacks that can be sourcemapped to the original stack:
The
super(...args)
call should be sourcemapped to right before theclass
keyword inclass Child extends Parent {}
Actual behavior
Transpiled code produces stacks that are not sourcemapped
Version
1.9.2
Additional context
No response