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
Even if the function in switch statement has some expressions; like console.log("hi"), the minified result remains unchanged.
console.log("hi")
const k = (() => { switch (1) { case 0: function x() {} default: x(); } })();
No response
https://play.swc.rs/?version=1.4.11&code=H4sIAAAAAAAAA1WMvQqAIBSFd5%2FijLrVati7iClJoYNKgfjuXQuKvu38mhhSxgYFzgXUjMpApMNns4KPAhW30zE6WQzyMzquBJN9DDjpoLY3W6zTZc%2FyV6bO9MwbWBOk2AWJvP1RggAAAA%3D%3D&config=H4sIAAAAAAAAA32UO3LjMAyG%2B5zCozrFjostcoDtcgYOLYIyvSShIUDHmozvvtDDj40hdRI%2B%2FAAJgPh%2B2%2B2aE7XNx%2B5bPuWnt4Wg3P%2FFQkNmexFLA22y1JbQc%2FN%2BoycakbeRYDJdZ9KwLR3wpKL9r%2F1%2BUTQRkeCmWGwp5OCH55wtpr4A0ZNNrBKyJshM%2F%2BsXVvBrBFzqs%2F2AGMHmDWIsmZAZOiha4BZjtD2BOduiRBlPaksg1FKMsDI40xfsVZ5d4IBZcr5SB9aZFh0oKBRoOZxBk0kukWWS6yn3mbCDQ%2B26qc8%2F1HC2sVpWcsJlaomcVol6xEBsfM1aCWe4UoMZLsX9qQzeFOBa8qvuhCGv9OQvgFQgWqJsE2hxJw8v87Sm9pvKkL2MLA8Kl%2FnWbpmhk6KaELxS2bEyUDho3SzgagtjZVvtOAteKR8FBwa8l1lRQtNX4PaoJeWhB%2FQKkP5ar03VDMz9Fa7w8UFs4D9yS9YHbPFIlo%2FrlIZ0wLiRIAEf0W04SCsY13GRLXHp13nNDmQ0wKkulSbwugTkATCaOO3Ll9mQ5yERTRfx8FgTi8P1voeTzd3jvc%2Br%2BG1xaBK6OsFlyY%2F9nVfz7%2BbhdNvC94M3gT5vyjns9R%2F7ntJqMQYAAA%3D%3D
maybe
let k = void 0;
let k = void (void 0)();
which results in calling undefined ((void 0) is not a function)
undefined
(void 0) is not a function
1.4.11
The text was updated successfully, but these errors were encountered:
Hello @kdy1, @magic-akari
could you help me send my first pr?
Sorry, something went wrong.
@yazaldefilimone The code for the optimizer that uses variable data lives at https://github.com/swc-project/swc/tree/1839980185a5771f8e51fe6912438a08f2ed2fc2/crates/swc_ecma_minifier/src/compress/optimize and the code for variable analyzer lives at https://github.com/swc-project/swc/tree/1839980185a5771f8e51fe6912438a08f2ed2fc2/crates/swc_ecma_usage_analyzer/src/analyzer
Both the optimizer and analyzer use the visitor pattern, and you can follow visitor methods to understand the flow.
The visitor visits all fields of each types, and you can see the types at https://rustdoc.swc.rs/swc_ecma_ast/
No branches or pull requests
Describe the bug
Even if the function in switch statement has some expressions; like
console.log("hi")
, the minified result remains unchanged.Input code
Config
No response
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.4.11&code=H4sIAAAAAAAAA1WMvQqAIBSFd5%2FijLrVati7iClJoYNKgfjuXQuKvu38mhhSxgYFzgXUjMpApMNns4KPAhW30zE6WQzyMzquBJN9DDjpoLY3W6zTZc%2FyV6bO9MwbWBOk2AWJvP1RggAAAA%3D%3D&config=H4sIAAAAAAAAA32UO3LjMAyG%2B5zCozrFjostcoDtcgYOLYIyvSShIUDHmozvvtDDj40hdRI%2B%2FAAJgPh%2B2%2B2aE7XNx%2B5bPuWnt4Wg3P%2FFQkNmexFLA22y1JbQc%2FN%2BoycakbeRYDJdZ9KwLR3wpKL9r%2F1%2BUTQRkeCmWGwp5OCH55wtpr4A0ZNNrBKyJshM%2F%2BsXVvBrBFzqs%2F2AGMHmDWIsmZAZOiha4BZjtD2BOduiRBlPaksg1FKMsDI40xfsVZ5d4IBZcr5SB9aZFh0oKBRoOZxBk0kukWWS6yn3mbCDQ%2B26qc8%2F1HC2sVpWcsJlaomcVol6xEBsfM1aCWe4UoMZLsX9qQzeFOBa8qvuhCGv9OQvgFQgWqJsE2hxJw8v87Sm9pvKkL2MLA8Kl%2FnWbpmhk6KaELxS2bEyUDho3SzgagtjZVvtOAteKR8FBwa8l1lRQtNX4PaoJeWhB%2FQKkP5ar03VDMz9Fa7w8UFs4D9yS9YHbPFIlo%2FrlIZ0wLiRIAEf0W04SCsY13GRLXHp13nNDmQ0wKkulSbwugTkATCaOO3Ll9mQ5yERTRfx8FgTi8P1voeTzd3jvc%2Br%2BG1xaBK6OsFlyY%2F9nVfz7%2BbhdNvC94M3gT5vyjns9R%2F7ntJqMQYAAA%3D%3D
SWC Info output
No response
Expected behavior
maybe
Actual behavior
which results in calling
undefined
((void 0) is not a function
)Version
1.4.11
Additional context
No response
The text was updated successfully, but these errors were encountered: