Optimize away trailing |return| and |next| statements

There is no need to emit trailing |return| statements in generated
method code and in clients' |main| method. It is enough to just emit the
returned value (or |nil| if there isn't any). Similarly for trailing
|next| statements in blocks

The resulting code is a more idiomatic Ruby.

Based on a patch by Josef Reidinger.