Minifier removes empty array following empty hole at the LHS of array destructuring pattern
hyp3rflow opened this issue · comments
flow commented
Describe the bug
As the result of removing empty array in holed array, RHS value will not be iterated.
Input code
"use strict";
const k = (() => {
let [,[]] = gen();
})();
function* gen() {
yield 1;
console.log("hi");
yield [];
}
Config
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": false
},
"target": "es2022",
"loose": false,
"minify": {
"compress": {
"arguments": false,
"arrows": true,
"booleans": true,
"booleans_as_integers": false,
"collapse_vars": true,
"comparisons": true,
"computed_props": true,
"conditionals": true,
"dead_code": true,
"directives": true,
"drop_console": false,
"drop_debugger": true,
"evaluate": true,
"expression": false,
"hoist_funs": false,
"hoist_props": true,
"hoist_vars": false,
"if_return": true,
"join_vars": true,
"keep_classnames": false,
"keep_fargs": true,
"keep_fnames": false,
"keep_infinity": false,
"loops": true,
"negate_iife": true,
"properties": true,
"reduce_funcs": false,
"reduce_vars": false,
"side_effects": true,
"switches": true,
"typeofs": true,
"unsafe": false,
"unsafe_arrows": false,
"unsafe_comps": false,
"unsafe_Function": false,
"unsafe_math": false,
"unsafe_symbols": false,
"unsafe_methods": false,
"unsafe_proto": false,
"unsafe_regexp": false,
"unsafe_undefined": false,
"unused": true,
"const_to_let": true,
"pristine_globals": true
},
"mangle": false
}
},
"module": {
"type": "commonjs"
},
"minify": false,
"isModule": false
}
Playground link (or link to the minimal reproduction)
SWC Info output
No response
Expected behavior
"hi" in console.log
Actual behavior
no output
Version
1.5.2
Additional context
No response
flow commented
Sorry. I forgot to add console.log("hi")
in the input code, so I updated description and playground link!