Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettify decompiled code #311

Open
Mrgaton opened this issue Apr 15, 2024 · 5 comments
Open

Prettify decompiled code #311

Mrgaton opened this issue Apr 15, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@Mrgaton
Copy link

Mrgaton commented Apr 15, 2024

Problem Description

Prettify code from this

image

to something more like this

image

Proposal

It would be great to prettify some ifs if the bool definition isn't too big

also would be great if the variables could get more family-friendly names like

from this

	bool flag = DocumentSettings.DefaultKeyLength != null;
			if (flag)
			{
				this.KeyLength = DocumentSettings.DefaultKeyLength;
			}

to this

			bool defaultKeyLength = DocumentSettings.DefaultKeyLength != null;

			if (defaultKeyLength)
			{
				this.KeyLength = DocumentSettings.DefaultKeyLength;
			}

Alternatives

No response

Additional Context

No response

@Mrgaton Mrgaton added the enhancement New feature or request label Apr 15, 2024
@Mrgaton
Copy link
Author

Mrgaton commented Apr 15, 2024

for example here is checking if secret is null so would be nice if the variable could be named something like the

from

		public async Task<bool> Remove(string secret)
		{
			bool flag = secret == null;
			if (flag)
			{
				throw new ArgumentNullException("secret");
			}
			return await JSPasteClient.Remove(this._key, secret);
		}

to

		public async Task<bool> Remove(string secret)
		{
			bool secretNull = secret == null;

			if (secretNull)
			{
				throw new ArgumentNullException("secret");
			}

			return await JSPasteClient.Remove(this._key, secret);
		}

@Mrgaton
Copy link
Author

Mrgaton commented Apr 15, 2024

also put some new lines to some code like for ifs

@Mrgaton
Copy link
Author

Mrgaton commented Apr 15, 2024

and the nullables replace it with the '?' like in normal code

from this

		[Nullable(2)]
		public string Password
		{
			[NullableContext(2)]
			get;
			[NullableContext(2)]
			set;
		}

to this

		public string? Password { get; set; }

@Mrgaton Mrgaton changed the title Prettify code Prettify decompiled code Apr 15, 2024
@GazziFX
Copy link

GazziFX commented Apr 15, 2024

Nullable support is available in new-ilspy branch, and local name generation might be also changed a bit

@Mrgaton
Copy link
Author

Mrgaton commented Apr 15, 2024

If I get a new idea I will post it here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants