mishoo/UglifyJS2 — pull request #487 by syranide (2014-05-27 19:00:20+00:00)
Title: Fix broken return-statements for preserve_line and extend with no_empty_line

I found `preserve_line` extremely useful for production builds, allowing me to always trace back errors to the exact source line. However, I found that it was broken as-is as it would separate return-statements from the value they should return (which in JS means return nothing). I also added `no_empty_line` to avoid it creating tons and tons of empty lines in an attempt to (unsuccessfully) match line numbers with optimizations enabled.

It currently tests with `OUTPUT.substr(-6) !== "return"`, it is not very neat but it's very isolated (and safe). I feared that tracking it "correctly" would be too invasive for an edge-use kind of thing. I don't mind making it "proper" though.

Feel free to critique, reject, etc :)

However, I personally found this super useful and it seemed like Ben Alpert at Khan Academy was quite interested in it too (but he's using CLI so exposing it would be nice then), I've also talked to 1-2 more who also seemed really interested.