In Javascript, a method that ends without a return, or a return with no value, will return the value undefined. Since GWT already can handle undefined/null interchangably, we should then be able to support undefined in more places and save a few bytes by replacing return null with either return where we need the control break, or remove it entirely such as at the end of a method.
This must be done in JS optimizations, since it would be illegal in Java. It should be done fairly late too, as it shouldn't impact inlining, just improve output. Care must however be taken to not apply this to code originally writing in JS (e.g. JSNI), as it could in theory break Cast.maskUndefined() or the like, and force it to return undefined instead of the expected null.
This could impact native JsInterop types, so #10331 should be resolved first.
In Javascript, a method that ends without a return, or a return with no value, will return the value
undefined. Since GWT already can handle undefined/null interchangably, we should then be able to support undefined in more places and save a few bytes by replacingreturn nullwith eitherreturnwhere we need the control break, or remove it entirely such as at the end of a method.This must be done in JS optimizations, since it would be illegal in Java. It should be done fairly late too, as it shouldn't impact inlining, just improve output. Care must however be taken to not apply this to code originally writing in JS (e.g. JSNI), as it could in theory break Cast.maskUndefined() or the like, and force it to return undefined instead of the expected null.
This could impact native JsInterop types, so #10331 should be resolved first.