dotnet/roslyn

Decompilation should put new lines between blocks

Ouverte

#25 303 ouverte le 7 mars 2018

 (16 commentaires) (0 réaction) (0 personne assignée)C# (4 257 forks)batch import
Area-IDEIDE-Formatterhelp wanted

Métriques du dépôt

Stars
 (20 414 étoiles)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

Description

We should layout methods a little better by introducing new lines to make a little more readable (Reflector did this well)

  1. Create Console App (.NET Framework)
  2. In the following, CTRL+Click int
    class Program
    {
        static void Main(string[] args)
        {
            int foo;
        }
    }
  1. When prompted say Yes to decompile
  2. Scroll down to CompareTo:

Expected:

		public int CompareTo(object value)
		{
			if (value == null)
			{
				return 1;
			}

			if (value is int)
			{
				int num = (int)value;
				if (this < num)
				{
					return -1;
				}

				if (this > num)
				{
					return 1;
				}

				return 0;
			}

			throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"));
		}

Actual:

		public int CompareTo(object value)
		{
			if (value == null)
			{
				return 1;
			}
			if (value is int)
			{
				int num = (int)value;
				if (this < num)
				{
					return -1;
				}
				if (this > num)
				{
					return 1;
				}
				return 0;
			}
			throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"));
		}

Guide contributeur