[closes gh-9] Unrolled array and collection initializers.
This commit is contained in:
Родитель
0ed1bd4be8
Коммит
c0f1f800c6
|
@ -1 +1 @@
|
||||||
Subproject commit 1c66a85cfa9f4ca9793d96a8d1187a0bc21bc8be
|
Subproject commit 1e338e0fdc676a005522ae6a10adb627a6b94b11
|
|
@ -29,7 +29,9 @@ namespace SharpLab.Server.Decompilation {
|
||||||
YieldReturn = false,
|
YieldReturn = false,
|
||||||
AsyncAwait = false,
|
AsyncAwait = false,
|
||||||
AutomaticProperties = false,
|
AutomaticProperties = false,
|
||||||
ExpressionTrees = false
|
ExpressionTrees = false,
|
||||||
|
ArrayInitializers = false,
|
||||||
|
ObjectOrCollectionInitializers = false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace SharpLab.Tests {
|
||||||
[InlineData("Simple.cs2il")]
|
[InlineData("Simple.cs2il")]
|
||||||
[InlineData("Simple.vb2vb")]
|
[InlineData("Simple.vb2vb")]
|
||||||
[InlineData("Module.vb2vb")]
|
[InlineData("Module.vb2vb")]
|
||||||
|
// https://github.com/ashmind/SharpLab/issues/9
|
||||||
|
[InlineData("Lambda.CallInArray.cs2cs")]
|
||||||
public async Task SlowUpdate_ReturnsExpectedDecompiledCode(string resourceName) {
|
public async Task SlowUpdate_ReturnsExpectedDecompiledCode(string resourceName) {
|
||||||
var data = TestData.FromResource(resourceName);
|
var data = TestData.FromResource(resourceName);
|
||||||
var driver = await NewTestDriverAsync(data);
|
var driver = await NewTestDriverAsync(data);
|
||||||
|
|
|
@ -7,14 +7,18 @@ public class C {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?=>
|
#=>
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.0.0.0")]
|
[assembly: AssemblyVersion("0.0.0.0")]
|
||||||
|
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
|
||||||
[assembly: CompilationRelaxations(8)]
|
[assembly: CompilationRelaxations(8)]
|
||||||
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
|
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
|
||||||
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
|
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
|
||||||
|
@ -22,25 +26,46 @@ using System.Security.Permissions;
|
||||||
public class C
|
public class C
|
||||||
{
|
{
|
||||||
[CompilerGenerated]
|
[CompilerGenerated]
|
||||||
private static Func<int, int> CS$<>9__CachedAnonymousMethodDelegate1;
|
[Serializable]
|
||||||
public void M()
|
private sealed class <>c
|
||||||
{
|
{
|
||||||
Func<int, int> arg_1B_0;
|
public static readonly C.<>c <>9;
|
||||||
if (arg_1B_0 = C.CS$<>9__CachedAnonymousMethodDelegate1 == null)
|
|
||||||
|
public static Func<int, int> <>9__0_0;
|
||||||
|
|
||||||
|
static <>c()
|
||||||
{
|
{
|
||||||
C.CS$<>9__CachedAnonymousMethodDelegate1 = new Func<int, int>(C.<M>b__0);
|
// Note: this type is marked as 'beforefieldinit'.
|
||||||
|
C.<>c.<>9 = new C.<>c();
|
||||||
}
|
}
|
||||||
int[] array = new int[] {
|
|
||||||
1,
|
internal int <M>b__0_0(int s)
|
||||||
2,
|
|
||||||
3,
|
|
||||||
0
|
|
||||||
};
|
|
||||||
Console.WriteLine(array[3]);
|
|
||||||
}
|
|
||||||
[CompilerGenerated]
|
|
||||||
private static int <M>b__0(int s)
|
|
||||||
{
|
{
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void M()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[CompilerGenerated]
|
||||||
|
internal sealed class <PrivateImplementationDetails>
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 16)]
|
||||||
|
private struct __StaticArrayInitTypeSize=16
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static readonly <PrivateImplementationDetails>.__StaticArrayInitTypeSize=16 7C7D749A182D008FD83D960F228CB2B1A0177992 = bytearray(1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
Загрузка…
Ссылка в новой задаче