We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addInitializer
Calling addInitializer from a class decorator context throws if the decorator threw. As per spec this should not happen. Babel behaves correctly: https://babeljs.io/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&build=&builtIns=false&corejs=3.21&spec=false&loose=false&code_lz=DYUwLgBAhgJjCSA7AlmZVjIF4gE4G4AoAMwFdEBjNAe0QhhAoAoB9AGgioA8BKCAbwhgAFrmoB3AdDhJU6TDlwQAvhAC8nMF3wrCYXAE8pFYFADOZiAEEpAAQYUIAWyZ9-qj5yhgKwgcsJCWAQUNAxsPCZXdQA-fx4iINBcMCYAIgAHczMQGDSeQiA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&circleciRepo=&evaluate=true&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Creact%2Cstage-2%2Ctypescript&prettier=false&targets=&version=7.24.7&externalPlugins=&assumptions=%7B%7D
let addInitializer; function dec(_, ctx) { throw { addInitializer } = ctx; } try { class A { @dec m() {} } } catch {} addInitializer(() => {});
{ "jsc": { "parser": { "syntax": "typescript", "tsx": false, "decorators": true }, "target": "es2022", "loose": false, "minify": { "compress": false, "mangle": false }, "transform": { "legacyDecorator": false, "decoratorVersion": "2022-03" }, }, "module": { "type": "es6" }, "minify": false, "isModule": true }
https://play.swc.rs/?version=1.6.1&code=H4sIAAAAAAAAA1WMSwrEMAxD9z6FlinMDUKHdtlTlOBkaCBNIHGZT8ndx10WLSyhZ6UgcN4vOUp0Kf5CtfQ6MkssGT6wWR9g%2BQw4IVstb713HB3jRVh0kvrVnpNrDbO6SQewG33uuMROeNNAdN8wioxPLQZLfxsNdaCRAAAA&config=H4sIAAAAAAAAA3VQuwrDMAzc8xVBcwohhQ6du3btbhwluPiF5EBDyL%2FXzjuULkbSWXenG7I8hzdLuOdDLGPjBTHS1scJ9zaIT5xA6D2yJOUDFCsaOEGN0IzbrEbpSARHHKFAHU7AOOMQBLUYEh9yVVbVwgXaOcYzFxhlVdMf3UhnPCHzj6gRttXb%2FlmRhOXGkTkSaWyF7B%2Br1f9HvJBYOZsMJ7uX8go7%2B%2FSAcXU3aS8hpqDmA2%2Bwf1pv2XRA8XPdTDEVGeDHIymDMXI98WVjNn4BiKKsl6YBAAA%3D
No response
addInitializer does not throw.
addInitializer throws.
1.6.1
This throws because SWC sets decorationState.[[Finished]] to true even if the decorator threw. This should not be the case - it should stay false.
decorationState.[[Finished]]
true
false
The text was updated successfully, but these errors were encountered:
kdy1
No branches or pull requests
Describe the bug
Calling
addInitializer
from a class decorator context throws if the decorator threw. As per spec this should not happen. Babel behaves correctly: https://babeljs.io/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&build=&builtIns=false&corejs=3.21&spec=false&loose=false&code_lz=DYUwLgBAhgJjCSA7AlmZVjIF4gE4G4AoAMwFdEBjNAe0QhhAoAoB9AGgioA8BKCAbwhgAFrmoB3AdDhJU6TDlwQAvhAC8nMF3wrCYXAE8pFYFADOZiAEEpAAQYUIAWyZ9-qj5yhgKwgcsJCWAQUNAxsPCZXdQA-fx4iINBcMCYAIgAHczMQGDSeQiA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&circleciRepo=&evaluate=true&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Creact%2Cstage-2%2Ctypescript&prettier=false&targets=&version=7.24.7&externalPlugins=&assumptions=%7B%7DInput code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.6.1&code=H4sIAAAAAAAAA1WMSwrEMAxD9z6FlinMDUKHdtlTlOBkaCBNIHGZT8ndx10WLSyhZ6UgcN4vOUp0Kf5CtfQ6MkssGT6wWR9g%2BQw4IVstb713HB3jRVh0kvrVnpNrDbO6SQewG33uuMROeNNAdN8wioxPLQZLfxsNdaCRAAAA&config=H4sIAAAAAAAAA3VQuwrDMAzc8xVBcwohhQ6du3btbhwluPiF5EBDyL%2FXzjuULkbSWXenG7I8hzdLuOdDLGPjBTHS1scJ9zaIT5xA6D2yJOUDFCsaOEGN0IzbrEbpSARHHKFAHU7AOOMQBLUYEh9yVVbVwgXaOcYzFxhlVdMf3UhnPCHzj6gRttXb%2FlmRhOXGkTkSaWyF7B%2Br1f9HvJBYOZsMJ7uX8go7%2B%2FSAcXU3aS8hpqDmA2%2Bwf1pv2XRA8XPdTDEVGeDHIymDMXI98WVjNn4BiKKsl6YBAAA%3D
SWC Info output
No response
Expected behavior
addInitializer
does not throw.Actual behavior
addInitializer
throws.Version
1.6.1
Additional context
This throws because SWC sets
decorationState.[[Finished]]
totrue
even if the decorator threw. This should not be the case - it should stayfalse
.The text was updated successfully, but these errors were encountered: