The new lines are due to blocks being followed by a newline in the code. So something like:

    gen"""// code
         |$block
         |${getBlockResult(body)}
         |// more code"""

Will call `emitBlock(block)`, print a newline to `stream` and then process `getBlockResult(body)`. This could be avoided, but since it's generated code that nobody is going to read it probably isn't worth it.