Skip to main content

Module writer

Module writer 

Source
Expand description

Building up a file of generated code.

Nothing clever — an indented string builder. It exists so that indentation is tracked in one place rather than threaded through every emitter, and so that every generated file ends the same way: newline-terminated, no trailing blank lines, no stray whitespace at the end of a line.

That tidiness matters more than it sounds. Generated files get committed and diffed, and a file that regenerates with invisible differences makes every diff useless.

Structs§

CodeWriter
An indented buffer of generated code.