[gh-205] Updated to fixed ILSpy and added tests.
This commit is contained in:
Родитель
f1cb828248
Коммит
109dff8d2d
|
@ -1 +1 @@
|
|||
Subproject commit 73609219823ebc784757699cd54399e2c3ba6380
|
||||
Subproject commit 16fa076134a8f4a82b42eb515a660be0fa6f12b8
|
|
@ -1,4 +1,4 @@
|
|||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using ICSharpCode.Decompiler.Disassembler;
|
||||
using Mono.Cecil;
|
||||
|
@ -8,6 +8,9 @@ namespace SharpLab.Server.Decompilation {
|
|||
public class ILDecompiler : IDecompiler {
|
||||
public void Decompile(Stream assemblyStream, TextWriter codeWriter) {
|
||||
var assembly = AssemblyDefinition.ReadAssembly(assemblyStream);
|
||||
//#if DEBUG
|
||||
//assembly.Write(@"d:\Temp\assembly\" + System.DateTime.Now.Ticks + "-il.dll");
|
||||
//#endif
|
||||
|
||||
var output = new CustomizableIndentPlainTextOutput(codeWriter) {
|
||||
IndentationString = " "
|
||||
|
|
|
@ -47,8 +47,9 @@ namespace SharpLab.Tests {
|
|||
[InlineData("Module.vb2vb")]
|
||||
[InlineData("Lambda.CallInArray.cs2cs")] // https://github.com/ashmind/SharpLab/issues/9
|
||||
[InlineData("Cast.ExplicitOperatorOnNull.cs2cs")] // https://github.com/ashmind/SharpLab/issues/20
|
||||
[InlineData("Goto.TryWhile.cs2cs")] // https://github.com/ashmind/SharpLab/issues/123
|
||||
[InlineData("Goto.TryWhile.cs2cs")] // https://github.com/ashmind/SharpLab/issues/123
|
||||
[InlineData("Nullable.OperatorLifting.cs2cs")] // https://github.com/ashmind/SharpLab/issues/159
|
||||
[InlineData("Finalizer.Exception.cs2il")] // https://github.com/ashmind/SharpLab/issues/205
|
||||
public async Task SlowUpdate_ReturnsExpectedDecompiledCode(string resourceName) {
|
||||
var data = TestData.FromResource(resourceName);
|
||||
var driver = await NewTestDriverAsync(data);
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
public class C {
|
||||
~C() {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
#=>
|
||||
|
||||
.class private auto ansi '<Module>'
|
||||
{
|
||||
} // end of class <Module>
|
||||
|
||||
.class public auto ansi beforefieldinit C
|
||||
extends [mscorlib]System.Object
|
||||
{
|
||||
// Methods
|
||||
.method family hidebysig virtual
|
||||
instance void Finalize () cil managed
|
||||
{
|
||||
.override method instance void [mscorlib]System.Object::Finalize()
|
||||
// Method begins at RVA 0x2050
|
||||
// Code size 13 (0xd)
|
||||
.maxstack 1
|
||||
|
||||
IL_0000: newobj instance void [mscorlib]System.Exception::.ctor()
|
||||
IL_0005: throw
|
||||
IL_0006: ldarg.0
|
||||
IL_0007: call instance void [mscorlib]System.Object::Finalize()
|
||||
IL_000c: endfinally
|
||||
|
||||
Try IL_0000-IL_0005 Finally IL_0006-IL_000c
|
||||
} // end of method C::Finalize
|
||||
|
||||
.method public hidebysig specialname rtspecialname
|
||||
instance void .ctor () cil managed
|
||||
{
|
||||
// Method begins at RVA 0x207c
|
||||
// Code size 7 (0x7)
|
||||
.maxstack 8
|
||||
|
||||
IL_0000: ldarg.0
|
||||
IL_0001: call instance void [mscorlib]System.Object::.ctor()
|
||||
IL_0006: ret
|
||||
} // end of method C::.ctor
|
||||
|
||||
} // end of class C
|
Загрузка…
Ссылка в новой задаче