UglifyJS-old icon indicating copy to clipboard operation
UglifyJS-old copied to clipboard

"a?b():c()" should be "(a?b:c)()"

Open KSXGitHub opened this issue 9 years ago • 2 comments

Here's an example: The origin:

    function test(condition, func1, func2, arg1, arg2) {
        if (condition) {
            return func1(arg1, arg2);
        } else {
            return func2(arg1, arg2);
        }
    }

What I expect is:

    function test(a,b,c,d,e){return(a?b:c)(d,e)}

But what the tool gives me is ((t,u) is uneccessary repeated 2 times):

   function main(n,i,r,t,u){return n?i(t,u):r(t,u)}

KSXGitHub avatar Sep 08 '15 10:09 KSXGitHub

I guess uglify won't fix this.

zhanhb avatar Sep 08 '15 11:09 zhanhb

Sorry, I can't really see what this should do. Please rebase onto master and send in a new PR.

(Edit: disregard that, this project is no longer maintained)

rvanvelzen avatar Sep 08 '15 19:09 rvanvelzen