[closes gh-128] Suppressed variable inlining.
This commit is contained in:
Родитель
237ab5b467
Коммит
c77c232430
|
@ -1 +1 @@
|
|||
Subproject commit e4edcffab101aa0660e8fd83a5c7278c03924d6e
|
||||
Subproject commit 90a8646497e6171cd4c12f49e170b31bb742affd
|
|
@ -1,15 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using AshMind.Extensions;
|
||||
using ICSharpCode.Decompiler;
|
||||
using ICSharpCode.Decompiler.Ast;
|
||||
using ICSharpCode.Decompiler.Ast.Transforms;
|
||||
using ICSharpCode.NRefactory.CSharp;
|
||||
using Mono.Cecil;
|
||||
using SharpLab.Server.Decompilation.Internal;
|
||||
|
||||
namespace SharpLab.Server.Decompilation {
|
||||
public abstract class AstBasedDecompiler : IDecompiler {
|
||||
|
@ -24,7 +20,8 @@ namespace SharpLab.Server.Decompilation {
|
|||
});
|
||||
|
||||
var context = new DecompilerContext(module) {
|
||||
Settings = {
|
||||
Settings = {
|
||||
CanInlineVariables = false,
|
||||
OperatorOverloading = false,
|
||||
AnonymousMethods = false,
|
||||
YieldReturn = false,
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using ICSharpCode.Decompiler;
|
||||
using System.IO;
|
||||
using ICSharpCode.Decompiler.Ast;
|
||||
using ICSharpCode.NRefactory.CSharp;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using SharpLab.Server.Decompilation.Internal;
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ namespace SharpLab.Tests {
|
|||
[Theory]
|
||||
// https://github.com/ashmind/SharpLab/issues/25
|
||||
[InlineData("Condition.SimpleSwitch.cs2cs")]
|
||||
// https://github.com/ashmind/SharpLab/issues/128
|
||||
[InlineData("Variable.FromArgumentToCall.cs2cs")]
|
||||
public async Task SlowUpdate_ReturnsExpectedDecompiledCode_InDebug(string resourceName) {
|
||||
var data = TestData.FromResource(resourceName);
|
||||
var driver = await NewTestDriverAsync(data, OptimizationLevel.Debug);
|
||||
|
|
|
@ -25,7 +25,8 @@ public class C
|
|||
{
|
||||
public void M(string n)
|
||||
{
|
||||
if (!(n == "foo"))
|
||||
string a = n;
|
||||
if (!(a == "foo"))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,13 +44,14 @@ public class C
|
|||
Func<int, int> arg_1F_0;
|
||||
if ((arg_1F_0 = C.<>c.<>9__0_0) == null)
|
||||
{
|
||||
arg_1F_0 = (C.<>c.<>9__0_0 = new Func<int, int>(C.<>c.<>9.<M>b__0_0));
|
||||
C.<>c.<>9__0_0 = (arg_1F_0 = new Func<int, int>(C.<>c.<>9.<M>b__0_0));
|
||||
}
|
||||
Func<int, int> func = arg_1F_0;
|
||||
int[] expr_26 = new int[4];
|
||||
RuntimeHelpers.InitializeArray(expr_26, fieldof(<PrivateImplementationDetails>.7C7D749A182D008FD83D960F228CB2B1A0177992).FieldHandle);
|
||||
expr_26[3] = func(1);
|
||||
Console.WriteLine(expr_26[3]);
|
||||
int[] expr_31 = expr_26;
|
||||
expr_31[3] = func(1);
|
||||
Console.WriteLine(expr_31[3]);
|
||||
}
|
||||
}
|
||||
[CompilerGenerated]
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
|
||||
public class C {
|
||||
public void M(int argument) {
|
||||
var newVariableForArgument = argument;
|
||||
Console.WriteLine(newVariableForArgument);
|
||||
}
|
||||
}
|
||||
|
||||
#=>
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
|
||||
[assembly: CompilationRelaxations(8)]
|
||||
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
|
||||
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
|
||||
[module: UnverifiableCode]
|
||||
public class C
|
||||
{
|
||||
public void M(int argument)
|
||||
{
|
||||
int value = argument;
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
}
|
|
@ -28,6 +28,10 @@
|
|||
<None Remove="TestCode\Simple.vb2vb" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="TestCode\Variable.FromArgumentToCall.cs2cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="TestCode\Condition.SimpleSwitch.cs2cs" />
|
||||
</ItemGroup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче