Skip to content

Build tools: centralize code-gen indent handling in a CodeWriter#3121

Open
zhengyazhao wants to merge 1 commit into
StackExchange:mainfrom
zhengyazhao:refactor/build-tools-code-writer
Open

Build tools: centralize code-gen indent handling in a CodeWriter#3121
zhengyazhao wants to merge 1 commit into
StackExchange:mainfrom
zhengyazhao:refactor/build-tools-code-writer

Conversation

@zhengyazhao

Copy link
Copy Markdown

Implements #3033 using the second sketch from the issue: a small builder-style CodeWriter wrapping the existing StringBuilder, replacing the per-method int indent + local NewLine() pattern in AsciiHashGenerator (4 occurrences).

On the IndentedTextWriter option: its indent-on-next-write semantics would subtly change emitted whitespace. Since there was no functional win to justify that, I kept the StringBuilder core so the change is provably inert. (The preamble in Generate intentionally still writes to the raw StringBuilder to keep the diff minimal.)

Verification: captured generated output (EmitCompilerGeneratedFiles) before and after — AsciiHash.generated.cs (1,835 lines) is byte-for-byte identical; full solution builds with zero warnings; RESPite.Tests pass (1717/1717).

Closes #3033

…ckExchange#3033)

Replaces the per-method 'int indent + local NewLine()' pattern in
AsciiHashGenerator with a small builder-style CodeWriter wrapping the
existing StringBuilder, per the second sketch in StackExchange#3033. Generated
output is byte-for-byte identical.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Busywork: build-tools; investigate / refactor to use IndentedTextWriter

1 participant