Skip to content

Make all WriteTo methods in MLIR.Syntax public; remove Action callbacks#10

Merged
jonathanvdc merged 2 commits intomainfrom
copilot/make-writetomethods-public
Mar 29, 2026
Merged

Make all WriteTo methods in MLIR.Syntax public; remove Action callbacks#10
jonathanvdc merged 2 commits intomainfrom
copilot/make-writetomethods-public

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 29, 2026

All WriteTo methods on MLIR syntax nodes were internal, and several accepted Action<> delegate callbacks to handle recursive writing — making them awkward to call externally and tightly coupled to SyntaxWriter internals.

Changes

  • MLIR.Syntax nodes — promoted WriteTo on BlockArgumentSyntax, BlockSyntax, ModuleSyntax, OperationSyntax, and RegionSyntax from internal to public; added XML doc comments
  • Removed Action<> parametersOperationBodySyntax, GenericOperationBodySyntax, OperationSyntax, RegionSyntax, and BlockSyntax no longer accept write-region/write-operation callbacks; recursive writes now call writer.WriteRegion / writer.WriteOperation directly
  • SyntaxWriter — removed the now-redundant static lambda adapters from WriteOperation, WriteRegion, and WriteBlock
  • Generator (DialectSourceEmitter) — updated the emitted WriteTo override signature to match
  • Tests — updated manual OperationBodySyntax subclasses and the generator snapshot assertion

Before:

// internal, requires a callback delegate
internal void WriteTo(SyntaxWriter writer, int indentLevel,
    Action<SyntaxWriter, RegionSyntax, int> writeRegion);

After:

// public, no callback needed
public void WriteTo(SyntaxWriter writer, int indentLevel);

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Make all WriteTo methods public and clean up code Make all WriteTo methods in MLIR.Syntax public; remove Action callbacks Mar 29, 2026
Copilot AI requested a review from jonathanvdc March 29, 2026 05:44
@jonathanvdc jonathanvdc marked this pull request as ready for review March 29, 2026 14:30
@jonathanvdc jonathanvdc merged commit 8527863 into main Mar 29, 2026
1 check passed
@jonathanvdc jonathanvdc deleted the copilot/make-writetomethods-public branch March 29, 2026 14:32
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.

2 participants