Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Add flexible name formatting and use it to format ILAsm-style - #1535

Merged
MichalStrehovsky merged 6 commits into
dotnet:masterfrom
MichalStrehovsky:ilDisassembler
Jul 18, 2016
Merged

MichalStrehovsky merged 6 commits into
dotnet:masterfrom
MichalStrehovsky:ilDisassembler

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member
  • Base class for flexible name formatting. I have one other use for it in mind, and with this, we can probably reconsider our "ToString" formatting story in general.
  • Flexible name formatting for ILAsm syntax.
  • Revamp ILDisassembler

Moves us closer to fixing #1192 and #1276.

Instead of relying on `ToString`, format things similarly to what ILDasm
would show. The result should be close enough to ILAsm it, but I was
shooting for "optical similarity", rather than reading IL grammar and specs.
Comes with no guarantees, etc.

Also changing the `ILDisassembler` class to handle all of the token
resolution by itself. There's little point in having this pluggable.
throw new NotSupportedException();
}

public abstract string FormatName(ArrayType type);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be slow for complex types (e.g. nested generics). Would it better it these methods append instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed the only reason we would ever want to format names is for debugging purposes and therefore preferred the shorter/simpler version with string concatenation. But fixed to use Append in updated iteration.

@jkotas

jkotas commented Jul 18, 2016

Copy link
Copy Markdown
Member

LGTM

@MichalStrehovsky
MichalStrehovsky merged commit b1d509e into dotnet:master Jul 18, 2016
@MichalStrehovsky
MichalStrehovsky deleted the ilDisassembler branch July 18, 2016 22:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants