Rich-Harris / butternut

The fast, future-friendly minifier
https://butternut.now.sh
MIT License
1.17k stars 17 forks source link

Renaming function arguments doesn't play well with ES6 object shorthand #167

Closed RyanZim closed 7 years ago

RyanZim commented 7 years ago

Input:

function foo (a, b) {
  return {a, b}
}

Expected Output:

function foo(a,b){return {a,b}}

Actual Output:

function foo(n,r){return{a:n,b:r}}

This is wasting bytes. Don't know if this is common enough in real-world code to optimize, but just thought I'd point it out.

Conduitry commented 7 years ago

This has already come up in #72 but it might still make sense to have a narrower ticket just for this issue.

RyanZim commented 7 years ago

Ah, sorry. Didn't see that issue.

I think shorthand properties is (currently) the only place where this could happen

So I think I'll close this.