Browse Source

Implemented printing of .overrides and interfaces directives in IL.

pull/112/head
Artur Zgodziski 14 years ago
parent
commit
c81f81827f
  1. 3
      ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs
  2. 16
      ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs
  3. 1
      ICSharpCode.Decompiler/Tests/ICSharpCode.Decompiler.Tests.csproj
  4. 17
      ICSharpCode.Decompiler/Tests/Types/S_TypeDeclarations.cs

3
ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs

@ -49,6 +49,9 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -49,6 +49,9 @@ namespace ICSharpCode.Decompiler.Disassembler
{
MethodDefinition method = body.Method;
output.WriteLine("// Method begins at RVA 0x{0:x4}", method.RVA);
if (method.HasOverrides)
foreach (var methodOverride in method.Overrides)
output.WriteLine(".override {0}::{1}", methodOverride.DeclaringType.FullName, methodOverride.Name);
output.WriteLine("// Code size {0} (0x{0:x})", body.CodeSize);
output.WriteLine(".maxstack {0}", body.MaxStackSize);
if (method.DeclaringType.Module.Assembly.EntryPoint == method)

16
ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs

@ -333,6 +333,22 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -333,6 +333,22 @@ namespace ICSharpCode.Decompiler.Disassembler
output.WriteLine();
output.Unindent();
}
if (type.HasInterfaces) {
output.Indent();
for (int index = 0; index < type.Interfaces.Count; index++) {
if (index > 0)
output.WriteLine(",");
if (index == 0)
output.Write("implements ");
else
output.Write(" ");
if (type.Interfaces[index].Namespace != null)
output.Write("{0}.", type.Interfaces[index].Namespace);
output.Write(type.Interfaces[index].Name);
}
output.WriteLine();
output.Unindent();
}
output.WriteLine("{");
output.Indent();

1
ICSharpCode.Decompiler/Tests/ICSharpCode.Decompiler.Tests.csproj

@ -56,6 +56,7 @@ @@ -56,6 +56,7 @@
<Compile Include="IncrementDecrement.cs" />
<Compile Include="Switch.cs" />
<Compile Include="UnsafeCode.cs" />
<Compile Include="Types\S_TypeDeclarations.cs" />
<Compile Include="YieldReturn.cs" />
<None Include="Types\S_EnumSamples.cs" />
<None Include="CustomAttributes\S_AssemblyCustomAttribute.cs" />

17
ICSharpCode.Decompiler/Tests/Types/S_TypeDeclarations.cs

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
using System;
namespace ClassMultiInterface
{
public interface IA
{
}
public interface IA2 : IA
{
}
public interface IB
{
}
public class C : IA2, IB
{
}
}
Loading…
Cancel
Save