Rich-Harris/butternut

Bug: Unreachable code

loilo opened this issue · 0 comments

loilo commented

From trying to squash canvasXpress—man, these minified sources are real treasure chests for finding bugs.

Butternut seems to have problems with unreachable code after premature return statements. It removes variables but—appears to me as a known pattern by now—not their values.

Input:

function any_fn () {
    return false
    var any_value_1 = function(d) {
        return any_value_2
    }
}

Output Butternut:

function any_fn(){return!1;function(a){return any_value_2}}

Output UglifyJS:

function any_fn(){return!1}