mirror of https://github.com/icsharpcode/ILSpy.git
51 changed files with 2737 additions and 324 deletions
@ -0,0 +1,100 @@
@@ -0,0 +1,100 @@
|
||||
// Copyright (c) 2018 Daniel Grunwald
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
|
||||
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty |
||||
{ |
||||
public class TupleTests |
||||
{ |
||||
private abstract class OverloadResolution |
||||
{ |
||||
public abstract void M1((long, long) a); |
||||
public abstract void M1(object a); |
||||
|
||||
public void UseM1((int, int) a) |
||||
{ |
||||
// M1(a); TODO: tuple conversion transform
|
||||
// Cast is required to avoid the overload usable via tuple conversion:
|
||||
M1((object)a); |
||||
} |
||||
} |
||||
|
||||
public ValueTuple VT0; |
||||
public ValueTuple<int> VT1; |
||||
public ValueTuple<int, int, int, int, int, int, int, ValueTuple> VT7EmptyRest; |
||||
|
||||
public (int, uint) Unnamed2; |
||||
public (int, int, int) Unnamed3; |
||||
public (int, int, int, int) Unnamed4; |
||||
public (int, int, int, int, int) Unnamed5; |
||||
public (int, int, int, int, int, int) Unnamed6; |
||||
public (int, int, int, int, int, int, int) Unnamed7; |
||||
public (int, int, int, int, int, int, int, int) Unnamed8; |
||||
|
||||
public (int a, uint b) Named2; |
||||
public (int a, uint b)[] Named2Array; |
||||
public (int a, int b, int c, int d, int e, int f, int g, int h) Named8; |
||||
|
||||
public (int, int a, int, int b, int) PartiallyNamed; |
||||
|
||||
public ((int a, int b) x, (int, int) y, (int c, int d) z) Nested1; |
||||
public ((object a, dynamic b), dynamic, (dynamic c, object d)) Nested2; |
||||
public (ValueTuple a, (int x1, int x2), ValueTuple<int> b, (int y1, int y2), (int, int) c) Nested3; |
||||
public (int a, int b, int c, int d, int e, int f, int g, int h, (int i, int j)) Nested4; |
||||
|
||||
public Dictionary<(int a, string b), (string c, int d)> TupleDict; |
||||
|
||||
public int VT1Member => VT1.Item1; |
||||
public int AccessUnnamed8 => Unnamed8.Item8; |
||||
public int AccessNamed8 => Named8.h; |
||||
public int AccessPartiallyNamed => PartiallyNamed.a + PartiallyNamed.Item3; |
||||
|
||||
public ValueTuple<int> NewTuple1 => new ValueTuple<int>(1); |
||||
public (int a, int b) NewTuple2 => (1, 2); |
||||
public object BoxedTuple10 => (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
||||
|
||||
public (uint, int) SwapUnnamed => (Unnamed2.Item2, Unnamed2.Item1); |
||||
public (uint, int) SwapNamed2 => (Named2.b, Named2.a); |
||||
|
||||
public int TupleHash => (1, 2, 3).GetHashCode(); |
||||
public int TupleHash2 => Named2.GetHashCode(); |
||||
|
||||
public (int, int) AccessRest => (1, 2, 3, 4, 5, 6, 7, 8, 9).Rest; |
||||
|
||||
public (string, object, Action) TargetTyping => (null, 1, delegate { |
||||
}); |
||||
|
||||
public object NotTargetTyping => ((string)null, (object)1, (Action)delegate { |
||||
}); |
||||
|
||||
public void UseDict() |
||||
{ |
||||
if (TupleDict.Count > 10) { |
||||
TupleDict.Clear(); |
||||
} |
||||
// TODO: it would be nice if we could infer the name 'c' for the local
|
||||
string item = TupleDict[(1, "abc")].c; |
||||
Console.WriteLine(item); |
||||
Console.WriteLine(item); |
||||
Console.WriteLine(TupleDict.Values.ToList().First().d); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,519 @@
@@ -0,0 +1,519 @@
|
||||
|
||||
|
||||
|
||||
|
||||
// Metadata version: v4.0.30319 |
||||
.assembly extern mscorlib |
||||
{ |
||||
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. |
||||
.ver 4:0:0:0 |
||||
} |
||||
.assembly extern System.Core |
||||
{ |
||||
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. |
||||
.ver 4:0:0:0 |
||||
} |
||||
.assembly TupleTests |
||||
{ |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx |
||||
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. |
||||
|
||||
// --- The following custom attribute is added automatically, do not uncomment ------- |
||||
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 ) |
||||
|
||||
.permissionset reqmin |
||||
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} |
||||
.hash algorithm 0x00008004 |
||||
.ver 0:0:0:0 |
||||
} |
||||
.module TupleTests.dll |
||||
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) |
||||
.imagebase 0x10000000 |
||||
.file alignment 0x00000200 |
||||
.stackreserve 0x00100000 |
||||
.subsystem 0x0003 // WINDOWS_CUI |
||||
.corflags 0x00000001 // ILONLY |
||||
|
||||
|
||||
// =============== CLASS MEMBERS DECLARATION =================== |
||||
|
||||
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests |
||||
extends [mscorlib]System.Object |
||||
{ |
||||
.class abstract auto ansi nested private beforefieldinit OverloadResolution |
||||
extends [mscorlib]System.Object |
||||
{ |
||||
.method public hidebysig newslot abstract virtual |
||||
instance void M1(valuetype [mscorlib]System.ValueTuple`2<int64,int64> a) cil managed |
||||
{ |
||||
} // end of method OverloadResolution::M1 |
||||
|
||||
.method public hidebysig newslot abstract virtual |
||||
instance void M1(object a) cil managed |
||||
{ |
||||
} // end of method OverloadResolution::M1 |
||||
|
||||
.method public hidebysig instance void |
||||
UseM1(valuetype [mscorlib]System.ValueTuple`2<int32,int32> a) cil managed |
||||
{ |
||||
// Code size 13 (0xd) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldarg.1 |
||||
IL_0002: box valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
IL_0007: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/OverloadResolution::M1(object) |
||||
IL_000c: ret |
||||
} // end of method OverloadResolution::UseM1 |
||||
|
||||
.method family hidebysig specialname rtspecialname |
||||
instance void .ctor() cil managed |
||||
{ |
||||
// 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 OverloadResolution::.ctor |
||||
|
||||
} // end of class OverloadResolution |
||||
|
||||
.class auto ansi serializable sealed nested private beforefieldinit '<>c' |
||||
extends [mscorlib]System.Object |
||||
{ |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) |
||||
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' '<>9' |
||||
.field public static class [mscorlib]System.Action '<>9__45_0' |
||||
.field public static class [mscorlib]System.Action '<>9__47_0' |
||||
.method private hidebysig specialname rtspecialname static |
||||
void .cctor() cil managed |
||||
{ |
||||
// Code size 11 (0xb) |
||||
.maxstack 8 |
||||
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::.ctor() |
||||
IL_0005: stsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9' |
||||
IL_000a: ret |
||||
} // end of method '<>c'::.cctor |
||||
|
||||
.method public hidebysig specialname rtspecialname |
||||
instance void .ctor() cil managed |
||||
{ |
||||
// 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 |
||||
|
||||
.method assembly hidebysig instance void |
||||
'<get_TargetTyping>b__45_0'() cil managed |
||||
{ |
||||
// Code size 1 (0x1) |
||||
.maxstack 8 |
||||
IL_0000: ret |
||||
} // end of method '<>c'::'<get_TargetTyping>b__45_0' |
||||
|
||||
.method assembly hidebysig instance void |
||||
'<get_NotTargetTyping>b__47_0'() cil managed |
||||
{ |
||||
// Code size 1 (0x1) |
||||
.maxstack 8 |
||||
IL_0000: ret |
||||
} // end of method '<>c'::'<get_NotTargetTyping>b__47_0' |
||||
|
||||
} // end of class '<>c' |
||||
|
||||
.field public valuetype [mscorlib]System.ValueTuple VT0 |
||||
.field public valuetype [mscorlib]System.ValueTuple`1<int32> VT1 |
||||
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple> VT7EmptyRest |
||||
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32> Unnamed2 |
||||
.field public valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> Unnamed3 |
||||
.field public valuetype [mscorlib]System.ValueTuple`4<int32,int32,int32,int32> Unnamed4 |
||||
.field public valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> Unnamed5 |
||||
.field public valuetype [mscorlib]System.ValueTuple`6<int32,int32,int32,int32,int32,int32> Unnamed6 |
||||
.field public valuetype [mscorlib]System.ValueTuple`7<int32,int32,int32,int32,int32,int32,int32> Unnamed7 |
||||
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> Unnamed8 |
||||
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32> Named2 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b.. |
||||
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32>[] Named2Array |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b.. |
||||
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> Named8 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 09 00 00 00 01 61 01 62 01 63 01 64 01 65 // .......a.b.c.d.e |
||||
01 66 01 67 01 68 FF 00 00 ) // .f.g.h... |
||||
.field public valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> PartiallyNamed |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 05 00 00 00 FF 01 61 FF 01 62 FF 00 00 ) // ........a..b... |
||||
.field public valuetype [mscorlib]System.ValueTuple`3<valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>> Nested1 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 09 00 00 00 01 78 01 79 01 7A 01 61 01 62 // .......x.y.z.a.b |
||||
FF FF 01 63 01 64 00 00 ) // ...c.d.. |
||||
.field public valuetype [mscorlib]System.ValueTuple`3<valuetype [mscorlib]System.ValueTuple`2<object,object>,object,valuetype [mscorlib]System.ValueTuple`2<object,object>> Nested2 |
||||
.custom instance void [System.Core]System.Runtime.CompilerServices.DynamicAttribute::.ctor(bool[]) = ( 01 00 08 00 00 00 00 00 00 01 01 00 01 00 00 00 ) |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 07 00 00 00 FF FF FF 01 61 01 62 01 63 01 // ..........a.b.c. |
||||
64 00 00 ) // d.. |
||||
.field public valuetype [mscorlib]System.ValueTuple`5<valuetype [mscorlib]System.ValueTuple,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`1<int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>> Nested3 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 0C 00 00 00 01 61 FF 01 62 FF 01 63 02 78 // .......a..b..c.x |
||||
31 02 78 32 FF 02 79 31 02 79 32 FF FF 00 00 ) // 1.x2..y1.y2.... |
||||
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>> Nested4 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 0D 00 00 00 01 61 01 62 01 63 01 64 01 65 // .......a.b.c.d.e |
||||
01 66 01 67 01 68 FF FF FF 01 69 01 6A 00 00 ) // .f.g.h....i.j.. |
||||
.field public class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> TupleDict |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 04 00 00 00 01 61 01 62 01 63 01 64 00 00 ) // .......a.b.c.d.. |
||||
.method public hidebysig specialname instance int32 |
||||
get_VT1Member() cil managed |
||||
{ |
||||
// Code size 12 (0xc) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::VT1 |
||||
IL_0006: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1 |
||||
IL_000b: ret |
||||
} // end of method TupleTests::get_VT1Member |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_AccessUnnamed8() cil managed |
||||
{ |
||||
// Code size 17 (0x11) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed8 |
||||
IL_0006: ldflda !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>>::Rest |
||||
IL_000b: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1 |
||||
IL_0010: ret |
||||
} // end of method TupleTests::get_AccessUnnamed8 |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_AccessNamed8() cil managed |
||||
{ |
||||
// Code size 17 (0x11) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named8 |
||||
IL_0006: ldflda !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>>::Rest |
||||
IL_000b: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1 |
||||
IL_0010: ret |
||||
} // end of method TupleTests::get_AccessNamed8 |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_AccessPartiallyNamed() cil managed |
||||
{ |
||||
// Code size 24 (0x18) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::PartiallyNamed |
||||
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32>::Item2 |
||||
IL_000b: ldarg.0 |
||||
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::PartiallyNamed |
||||
IL_0011: ldfld !2 valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32>::Item3 |
||||
IL_0016: add |
||||
IL_0017: ret |
||||
} // end of method TupleTests::get_AccessPartiallyNamed |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`1<int32> |
||||
get_NewTuple1() cil managed |
||||
{ |
||||
// Code size 7 (0x7) |
||||
.maxstack 8 |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: newobj instance void valuetype [mscorlib]System.ValueTuple`1<int32>::.ctor(!0) |
||||
IL_0006: ret |
||||
} // end of method TupleTests::get_NewTuple1 |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
get_NewTuple2() cil managed |
||||
{ |
||||
.param [0] |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b.. |
||||
// Code size 8 (0x8) |
||||
.maxstack 8 |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: ldc.i4.2 |
||||
IL_0002: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,int32>::.ctor(!0, |
||||
!1) |
||||
IL_0007: ret |
||||
} // end of method TupleTests::get_NewTuple2 |
||||
|
||||
.method public hidebysig specialname instance object |
||||
get_BoxedTuple10() cil managed |
||||
{ |
||||
// Code size 28 (0x1c) |
||||
.maxstack 10 |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: ldc.i4.2 |
||||
IL_0002: ldc.i4.3 |
||||
IL_0003: ldc.i4.4 |
||||
IL_0004: ldc.i4.5 |
||||
IL_0005: ldc.i4.6 |
||||
IL_0006: ldc.i4.7 |
||||
IL_0007: ldc.i4.8 |
||||
IL_0008: ldc.i4.s 9 |
||||
IL_000a: ldc.i4.s 10 |
||||
IL_000c: newobj instance void valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>::.ctor(!0, |
||||
!1, |
||||
!2) |
||||
IL_0011: newobj instance void valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>>::.ctor(!0, |
||||
!1, |
||||
!2, |
||||
!3, |
||||
!4, |
||||
!5, |
||||
!6, |
||||
!7) |
||||
IL_0016: box valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>> |
||||
IL_001b: ret |
||||
} // end of method TupleTests::get_BoxedTuple10 |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> |
||||
get_SwapUnnamed() cil managed |
||||
{ |
||||
// Code size 28 (0x1c) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed2 |
||||
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item2 |
||||
IL_000b: ldarg.0 |
||||
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed2 |
||||
IL_0011: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item1 |
||||
IL_0016: newobj instance void valuetype [mscorlib]System.ValueTuple`2<uint32,int32>::.ctor(!0, |
||||
!1) |
||||
IL_001b: ret |
||||
} // end of method TupleTests::get_SwapUnnamed |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> |
||||
get_SwapNamed2() cil managed |
||||
{ |
||||
// Code size 28 (0x1c) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2 |
||||
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item2 |
||||
IL_000b: ldarg.0 |
||||
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2 |
||||
IL_0011: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item1 |
||||
IL_0016: newobj instance void valuetype [mscorlib]System.ValueTuple`2<uint32,int32>::.ctor(!0, |
||||
!1) |
||||
IL_001b: ret |
||||
} // end of method TupleTests::get_SwapNamed2 |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_TupleHash() cil managed |
||||
{ |
||||
// Code size 23 (0x17) |
||||
.maxstack 3 |
||||
.locals init (valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> V_0) |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: ldc.i4.2 |
||||
IL_0002: ldc.i4.3 |
||||
IL_0003: newobj instance void valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>::.ctor(!0, |
||||
!1, |
||||
!2) |
||||
IL_0008: stloc.0 |
||||
IL_0009: ldloca.s V_0 |
||||
IL_000b: constrained. valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> |
||||
IL_0011: callvirt instance int32 [mscorlib]System.Object::GetHashCode() |
||||
IL_0016: ret |
||||
} // end of method TupleTests::get_TupleHash |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_TupleHash2() cil managed |
||||
{ |
||||
// Code size 18 (0x12) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2 |
||||
IL_0006: constrained. valuetype [mscorlib]System.ValueTuple`2<int32,uint32> |
||||
IL_000c: callvirt instance int32 [mscorlib]System.Object::GetHashCode() |
||||
IL_0011: ret |
||||
} // end of method TupleTests::get_TupleHash2 |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
get_AccessRest() cil managed |
||||
{ |
||||
// Code size 26 (0x1a) |
||||
.maxstack 9 |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: ldc.i4.2 |
||||
IL_0002: ldc.i4.3 |
||||
IL_0003: ldc.i4.4 |
||||
IL_0004: ldc.i4.5 |
||||
IL_0005: ldc.i4.6 |
||||
IL_0006: ldc.i4.7 |
||||
IL_0007: ldc.i4.8 |
||||
IL_0008: ldc.i4.s 9 |
||||
IL_000a: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,int32>::.ctor(!0, |
||||
!1) |
||||
IL_000f: newobj instance void valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>::.ctor(!0, |
||||
!1, |
||||
!2, |
||||
!3, |
||||
!4, |
||||
!5, |
||||
!6, |
||||
!7) |
||||
IL_0014: ldfld !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>::Rest |
||||
IL_0019: ret |
||||
} // end of method TupleTests::get_AccessRest |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> |
||||
get_TargetTyping() cil managed |
||||
{ |
||||
// Code size 44 (0x2c) |
||||
.maxstack 8 |
||||
IL_0000: ldnull |
||||
IL_0001: ldc.i4.1 |
||||
IL_0002: box [mscorlib]System.Int32 |
||||
IL_0007: ldsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__45_0' |
||||
IL_000c: dup |
||||
IL_000d: brtrue.s IL_0026 |
||||
|
||||
IL_000f: pop |
||||
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9' |
||||
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<get_TargetTyping>b__45_0'() |
||||
IL_001b: newobj instance void [mscorlib]System.Action::.ctor(object, |
||||
native int) |
||||
IL_0020: dup |
||||
IL_0021: stsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__45_0' |
||||
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>::.ctor(!0, |
||||
!1, |
||||
!2) |
||||
IL_002b: ret |
||||
} // end of method TupleTests::get_TargetTyping |
||||
|
||||
.method public hidebysig specialname instance object |
||||
get_NotTargetTyping() cil managed |
||||
{ |
||||
// Code size 49 (0x31) |
||||
.maxstack 8 |
||||
IL_0000: ldnull |
||||
IL_0001: ldc.i4.1 |
||||
IL_0002: box [mscorlib]System.Int32 |
||||
IL_0007: ldsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__47_0' |
||||
IL_000c: dup |
||||
IL_000d: brtrue.s IL_0026 |
||||
|
||||
IL_000f: pop |
||||
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9' |
||||
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<get_NotTargetTyping>b__47_0'() |
||||
IL_001b: newobj instance void [mscorlib]System.Action::.ctor(object, |
||||
native int) |
||||
IL_0020: dup |
||||
IL_0021: stsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__47_0' |
||||
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>::.ctor(!0, |
||||
!1, |
||||
!2) |
||||
IL_002b: box valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> |
||||
IL_0030: ret |
||||
} // end of method TupleTests::get_NotTargetTyping |
||||
|
||||
.method public hidebysig instance void |
||||
UseDict() cil managed |
||||
{ |
||||
// Code size 96 (0x60) |
||||
.maxstack 3 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict |
||||
IL_0006: callvirt instance int32 class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Count() |
||||
IL_000b: ldc.i4.s 10 |
||||
IL_000d: ble.s IL_001a |
||||
|
||||
IL_000f: ldarg.0 |
||||
IL_0010: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict |
||||
IL_0015: callvirt instance void class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::Clear() |
||||
IL_001a: ldarg.0 |
||||
IL_001b: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict |
||||
IL_0020: ldc.i4.1 |
||||
IL_0021: ldstr "abc" |
||||
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,string>::.ctor(!0, |
||||
!1) |
||||
IL_002b: callvirt instance !1 class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Item(!0) |
||||
IL_0030: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<string,int32>::Item1 |
||||
IL_0035: dup |
||||
IL_0036: call void [mscorlib]System.Console::WriteLine(string) |
||||
IL_003b: call void [mscorlib]System.Console::WriteLine(string) |
||||
IL_0040: ldarg.0 |
||||
IL_0041: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict |
||||
IL_0046: callvirt instance class [mscorlib]System.Collections.Generic.Dictionary`2/ValueCollection<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Values() |
||||
IL_004b: call class [mscorlib]System.Collections.Generic.List`1<!!0> [System.Core]System.Linq.Enumerable::ToList<valuetype [mscorlib]System.ValueTuple`2<string,int32>>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>) |
||||
IL_0050: call !!0 [System.Core]System.Linq.Enumerable::First<valuetype [mscorlib]System.ValueTuple`2<string,int32>>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>) |
||||
IL_0055: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<string,int32>::Item2 |
||||
IL_005a: call void [mscorlib]System.Console::WriteLine(int32) |
||||
IL_005f: ret |
||||
} // end of method TupleTests::UseDict |
||||
|
||||
.method public hidebysig specialname rtspecialname |
||||
instance void .ctor() cil managed |
||||
{ |
||||
// 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 TupleTests::.ctor |
||||
|
||||
.property instance int32 VT1Member() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_VT1Member() |
||||
} // end of property TupleTests::VT1Member |
||||
.property instance int32 AccessUnnamed8() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessUnnamed8() |
||||
} // end of property TupleTests::AccessUnnamed8 |
||||
.property instance int32 AccessNamed8() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessNamed8() |
||||
} // end of property TupleTests::AccessNamed8 |
||||
.property instance int32 AccessPartiallyNamed() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessPartiallyNamed() |
||||
} // end of property TupleTests::AccessPartiallyNamed |
||||
.property instance valuetype [mscorlib]System.ValueTuple`1<int32> |
||||
NewTuple1() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NewTuple1() |
||||
} // end of property TupleTests::NewTuple1 |
||||
.property instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
NewTuple2() |
||||
{ |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b.. |
||||
.get instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NewTuple2() |
||||
} // end of property TupleTests::NewTuple2 |
||||
.property instance object BoxedTuple10() |
||||
{ |
||||
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_BoxedTuple10() |
||||
} // end of property TupleTests::BoxedTuple10 |
||||
.property instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> |
||||
SwapUnnamed() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_SwapUnnamed() |
||||
} // end of property TupleTests::SwapUnnamed |
||||
.property instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> |
||||
SwapNamed2() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_SwapNamed2() |
||||
} // end of property TupleTests::SwapNamed2 |
||||
.property instance int32 TupleHash() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TupleHash() |
||||
} // end of property TupleTests::TupleHash |
||||
.property instance int32 TupleHash2() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TupleHash2() |
||||
} // end of property TupleTests::TupleHash2 |
||||
.property instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
AccessRest() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessRest() |
||||
} // end of property TupleTests::AccessRest |
||||
.property instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> |
||||
TargetTyping() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TargetTyping() |
||||
} // end of property TupleTests::TargetTyping |
||||
.property instance object NotTargetTyping() |
||||
{ |
||||
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NotTargetTyping() |
||||
} // end of property TupleTests::NotTargetTyping |
||||
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests |
||||
|
||||
|
||||
// ============================================================= |
||||
|
||||
// *********** DISASSEMBLY COMPLETE *********************** |
@ -0,0 +1,540 @@
@@ -0,0 +1,540 @@
|
||||
|
||||
|
||||
|
||||
|
||||
// Metadata version: v4.0.30319 |
||||
.assembly extern mscorlib |
||||
{ |
||||
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. |
||||
.ver 4:0:0:0 |
||||
} |
||||
.assembly extern System.Core |
||||
{ |
||||
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. |
||||
.ver 4:0:0:0 |
||||
} |
||||
.assembly TupleTests |
||||
{ |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx |
||||
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. |
||||
|
||||
// --- The following custom attribute is added automatically, do not uncomment ------- |
||||
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) |
||||
|
||||
.permissionset reqmin |
||||
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} |
||||
.hash algorithm 0x00008004 |
||||
.ver 0:0:0:0 |
||||
} |
||||
.module TupleTests.dll |
||||
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) |
||||
.imagebase 0x10000000 |
||||
.file alignment 0x00000200 |
||||
.stackreserve 0x00100000 |
||||
.subsystem 0x0003 // WINDOWS_CUI |
||||
.corflags 0x00000001 // ILONLY |
||||
|
||||
|
||||
// =============== CLASS MEMBERS DECLARATION =================== |
||||
|
||||
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests |
||||
extends [mscorlib]System.Object |
||||
{ |
||||
.class abstract auto ansi nested private beforefieldinit OverloadResolution |
||||
extends [mscorlib]System.Object |
||||
{ |
||||
.method public hidebysig newslot abstract virtual |
||||
instance void M1(valuetype [mscorlib]System.ValueTuple`2<int64,int64> a) cil managed |
||||
{ |
||||
} // end of method OverloadResolution::M1 |
||||
|
||||
.method public hidebysig newslot abstract virtual |
||||
instance void M1(object a) cil managed |
||||
{ |
||||
} // end of method OverloadResolution::M1 |
||||
|
||||
.method public hidebysig instance void |
||||
UseM1(valuetype [mscorlib]System.ValueTuple`2<int32,int32> a) cil managed |
||||
{ |
||||
// Code size 15 (0xf) |
||||
.maxstack 8 |
||||
IL_0000: nop |
||||
IL_0001: ldarg.0 |
||||
IL_0002: ldarg.1 |
||||
IL_0003: box valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
IL_0008: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/OverloadResolution::M1(object) |
||||
IL_000d: nop |
||||
IL_000e: ret |
||||
} // end of method OverloadResolution::UseM1 |
||||
|
||||
.method family hidebysig specialname rtspecialname |
||||
instance void .ctor() cil managed |
||||
{ |
||||
// Code size 8 (0x8) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: call instance void [mscorlib]System.Object::.ctor() |
||||
IL_0006: nop |
||||
IL_0007: ret |
||||
} // end of method OverloadResolution::.ctor |
||||
|
||||
} // end of class OverloadResolution |
||||
|
||||
.class auto ansi serializable sealed nested private beforefieldinit '<>c' |
||||
extends [mscorlib]System.Object |
||||
{ |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) |
||||
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' '<>9' |
||||
.field public static class [mscorlib]System.Action '<>9__45_0' |
||||
.field public static class [mscorlib]System.Action '<>9__47_0' |
||||
.method private hidebysig specialname rtspecialname static |
||||
void .cctor() cil managed |
||||
{ |
||||
// Code size 11 (0xb) |
||||
.maxstack 8 |
||||
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::.ctor() |
||||
IL_0005: stsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9' |
||||
IL_000a: ret |
||||
} // end of method '<>c'::.cctor |
||||
|
||||
.method public hidebysig specialname rtspecialname |
||||
instance void .ctor() cil managed |
||||
{ |
||||
// Code size 8 (0x8) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: call instance void [mscorlib]System.Object::.ctor() |
||||
IL_0006: nop |
||||
IL_0007: ret |
||||
} // end of method '<>c'::.ctor |
||||
|
||||
.method assembly hidebysig instance void |
||||
'<get_TargetTyping>b__45_0'() cil managed |
||||
{ |
||||
// Code size 2 (0x2) |
||||
.maxstack 8 |
||||
IL_0000: nop |
||||
IL_0001: ret |
||||
} // end of method '<>c'::'<get_TargetTyping>b__45_0' |
||||
|
||||
.method assembly hidebysig instance void |
||||
'<get_NotTargetTyping>b__47_0'() cil managed |
||||
{ |
||||
// Code size 2 (0x2) |
||||
.maxstack 8 |
||||
IL_0000: nop |
||||
IL_0001: ret |
||||
} // end of method '<>c'::'<get_NotTargetTyping>b__47_0' |
||||
|
||||
} // end of class '<>c' |
||||
|
||||
.field public valuetype [mscorlib]System.ValueTuple VT0 |
||||
.field public valuetype [mscorlib]System.ValueTuple`1<int32> VT1 |
||||
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple> VT7EmptyRest |
||||
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32> Unnamed2 |
||||
.field public valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> Unnamed3 |
||||
.field public valuetype [mscorlib]System.ValueTuple`4<int32,int32,int32,int32> Unnamed4 |
||||
.field public valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> Unnamed5 |
||||
.field public valuetype [mscorlib]System.ValueTuple`6<int32,int32,int32,int32,int32,int32> Unnamed6 |
||||
.field public valuetype [mscorlib]System.ValueTuple`7<int32,int32,int32,int32,int32,int32,int32> Unnamed7 |
||||
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> Unnamed8 |
||||
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32> Named2 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b.. |
||||
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32>[] Named2Array |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b.. |
||||
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> Named8 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 09 00 00 00 01 61 01 62 01 63 01 64 01 65 // .......a.b.c.d.e |
||||
01 66 01 67 01 68 FF 00 00 ) // .f.g.h... |
||||
.field public valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> PartiallyNamed |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 05 00 00 00 FF 01 61 FF 01 62 FF 00 00 ) // ........a..b... |
||||
.field public valuetype [mscorlib]System.ValueTuple`3<valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>> Nested1 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 09 00 00 00 01 78 01 79 01 7A 01 61 01 62 // .......x.y.z.a.b |
||||
FF FF 01 63 01 64 00 00 ) // ...c.d.. |
||||
.field public valuetype [mscorlib]System.ValueTuple`3<valuetype [mscorlib]System.ValueTuple`2<object,object>,object,valuetype [mscorlib]System.ValueTuple`2<object,object>> Nested2 |
||||
.custom instance void [System.Core]System.Runtime.CompilerServices.DynamicAttribute::.ctor(bool[]) = ( 01 00 08 00 00 00 00 00 00 01 01 00 01 00 00 00 ) |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 07 00 00 00 FF FF FF 01 61 01 62 01 63 01 // ..........a.b.c. |
||||
64 00 00 ) // d.. |
||||
.field public valuetype [mscorlib]System.ValueTuple`5<valuetype [mscorlib]System.ValueTuple,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`1<int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>> Nested3 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 0C 00 00 00 01 61 FF 01 62 FF 01 63 02 78 // .......a..b..c.x |
||||
31 02 78 32 FF 02 79 31 02 79 32 FF FF 00 00 ) // 1.x2..y1.y2.... |
||||
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>> Nested4 |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 0D 00 00 00 01 61 01 62 01 63 01 64 01 65 // .......a.b.c.d.e |
||||
01 66 01 67 01 68 FF FF FF 01 69 01 6A 00 00 ) // .f.g.h....i.j.. |
||||
.field public class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> TupleDict |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 04 00 00 00 01 61 01 62 01 63 01 64 00 00 ) // .......a.b.c.d.. |
||||
.method public hidebysig specialname instance int32 |
||||
get_VT1Member() cil managed |
||||
{ |
||||
// Code size 12 (0xc) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::VT1 |
||||
IL_0006: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1 |
||||
IL_000b: ret |
||||
} // end of method TupleTests::get_VT1Member |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_AccessUnnamed8() cil managed |
||||
{ |
||||
// Code size 17 (0x11) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed8 |
||||
IL_0006: ldflda !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>>::Rest |
||||
IL_000b: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1 |
||||
IL_0010: ret |
||||
} // end of method TupleTests::get_AccessUnnamed8 |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_AccessNamed8() cil managed |
||||
{ |
||||
// Code size 17 (0x11) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named8 |
||||
IL_0006: ldflda !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>>::Rest |
||||
IL_000b: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1 |
||||
IL_0010: ret |
||||
} // end of method TupleTests::get_AccessNamed8 |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_AccessPartiallyNamed() cil managed |
||||
{ |
||||
// Code size 24 (0x18) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::PartiallyNamed |
||||
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32>::Item2 |
||||
IL_000b: ldarg.0 |
||||
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::PartiallyNamed |
||||
IL_0011: ldfld !2 valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32>::Item3 |
||||
IL_0016: add |
||||
IL_0017: ret |
||||
} // end of method TupleTests::get_AccessPartiallyNamed |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`1<int32> |
||||
get_NewTuple1() cil managed |
||||
{ |
||||
// Code size 7 (0x7) |
||||
.maxstack 8 |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: newobj instance void valuetype [mscorlib]System.ValueTuple`1<int32>::.ctor(!0) |
||||
IL_0006: ret |
||||
} // end of method TupleTests::get_NewTuple1 |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
get_NewTuple2() cil managed |
||||
{ |
||||
.param [0] |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b.. |
||||
// Code size 8 (0x8) |
||||
.maxstack 8 |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: ldc.i4.2 |
||||
IL_0002: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,int32>::.ctor(!0, |
||||
!1) |
||||
IL_0007: ret |
||||
} // end of method TupleTests::get_NewTuple2 |
||||
|
||||
.method public hidebysig specialname instance object |
||||
get_BoxedTuple10() cil managed |
||||
{ |
||||
// Code size 28 (0x1c) |
||||
.maxstack 10 |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: ldc.i4.2 |
||||
IL_0002: ldc.i4.3 |
||||
IL_0003: ldc.i4.4 |
||||
IL_0004: ldc.i4.5 |
||||
IL_0005: ldc.i4.6 |
||||
IL_0006: ldc.i4.7 |
||||
IL_0007: ldc.i4.8 |
||||
IL_0008: ldc.i4.s 9 |
||||
IL_000a: ldc.i4.s 10 |
||||
IL_000c: newobj instance void valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>::.ctor(!0, |
||||
!1, |
||||
!2) |
||||
IL_0011: newobj instance void valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>>::.ctor(!0, |
||||
!1, |
||||
!2, |
||||
!3, |
||||
!4, |
||||
!5, |
||||
!6, |
||||
!7) |
||||
IL_0016: box valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>> |
||||
IL_001b: ret |
||||
} // end of method TupleTests::get_BoxedTuple10 |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> |
||||
get_SwapUnnamed() cil managed |
||||
{ |
||||
// Code size 28 (0x1c) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed2 |
||||
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item2 |
||||
IL_000b: ldarg.0 |
||||
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed2 |
||||
IL_0011: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item1 |
||||
IL_0016: newobj instance void valuetype [mscorlib]System.ValueTuple`2<uint32,int32>::.ctor(!0, |
||||
!1) |
||||
IL_001b: ret |
||||
} // end of method TupleTests::get_SwapUnnamed |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> |
||||
get_SwapNamed2() cil managed |
||||
{ |
||||
// Code size 28 (0x1c) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2 |
||||
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item2 |
||||
IL_000b: ldarg.0 |
||||
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2 |
||||
IL_0011: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item1 |
||||
IL_0016: newobj instance void valuetype [mscorlib]System.ValueTuple`2<uint32,int32>::.ctor(!0, |
||||
!1) |
||||
IL_001b: ret |
||||
} // end of method TupleTests::get_SwapNamed2 |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_TupleHash() cil managed |
||||
{ |
||||
// Code size 23 (0x17) |
||||
.maxstack 3 |
||||
.locals init (valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> V_0) |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: ldc.i4.2 |
||||
IL_0002: ldc.i4.3 |
||||
IL_0003: newobj instance void valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>::.ctor(!0, |
||||
!1, |
||||
!2) |
||||
IL_0008: stloc.0 |
||||
IL_0009: ldloca.s V_0 |
||||
IL_000b: constrained. valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> |
||||
IL_0011: callvirt instance int32 [mscorlib]System.Object::GetHashCode() |
||||
IL_0016: ret |
||||
} // end of method TupleTests::get_TupleHash |
||||
|
||||
.method public hidebysig specialname instance int32 |
||||
get_TupleHash2() cil managed |
||||
{ |
||||
// Code size 18 (0x12) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2 |
||||
IL_0006: constrained. valuetype [mscorlib]System.ValueTuple`2<int32,uint32> |
||||
IL_000c: callvirt instance int32 [mscorlib]System.Object::GetHashCode() |
||||
IL_0011: ret |
||||
} // end of method TupleTests::get_TupleHash2 |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
get_AccessRest() cil managed |
||||
{ |
||||
// Code size 26 (0x1a) |
||||
.maxstack 9 |
||||
IL_0000: ldc.i4.1 |
||||
IL_0001: ldc.i4.2 |
||||
IL_0002: ldc.i4.3 |
||||
IL_0003: ldc.i4.4 |
||||
IL_0004: ldc.i4.5 |
||||
IL_0005: ldc.i4.6 |
||||
IL_0006: ldc.i4.7 |
||||
IL_0007: ldc.i4.8 |
||||
IL_0008: ldc.i4.s 9 |
||||
IL_000a: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,int32>::.ctor(!0, |
||||
!1) |
||||
IL_000f: newobj instance void valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>::.ctor(!0, |
||||
!1, |
||||
!2, |
||||
!3, |
||||
!4, |
||||
!5, |
||||
!6, |
||||
!7) |
||||
IL_0014: ldfld !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>::Rest |
||||
IL_0019: ret |
||||
} // end of method TupleTests::get_AccessRest |
||||
|
||||
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> |
||||
get_TargetTyping() cil managed |
||||
{ |
||||
// Code size 44 (0x2c) |
||||
.maxstack 8 |
||||
IL_0000: ldnull |
||||
IL_0001: ldc.i4.1 |
||||
IL_0002: box [mscorlib]System.Int32 |
||||
IL_0007: ldsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__45_0' |
||||
IL_000c: dup |
||||
IL_000d: brtrue.s IL_0026 |
||||
|
||||
IL_000f: pop |
||||
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9' |
||||
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<get_TargetTyping>b__45_0'() |
||||
IL_001b: newobj instance void [mscorlib]System.Action::.ctor(object, |
||||
native int) |
||||
IL_0020: dup |
||||
IL_0021: stsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__45_0' |
||||
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>::.ctor(!0, |
||||
!1, |
||||
!2) |
||||
IL_002b: ret |
||||
} // end of method TupleTests::get_TargetTyping |
||||
|
||||
.method public hidebysig specialname instance object |
||||
get_NotTargetTyping() cil managed |
||||
{ |
||||
// Code size 49 (0x31) |
||||
.maxstack 8 |
||||
IL_0000: ldnull |
||||
IL_0001: ldc.i4.1 |
||||
IL_0002: box [mscorlib]System.Int32 |
||||
IL_0007: ldsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__47_0' |
||||
IL_000c: dup |
||||
IL_000d: brtrue.s IL_0026 |
||||
|
||||
IL_000f: pop |
||||
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9' |
||||
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<get_NotTargetTyping>b__47_0'() |
||||
IL_001b: newobj instance void [mscorlib]System.Action::.ctor(object, |
||||
native int) |
||||
IL_0020: dup |
||||
IL_0021: stsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__47_0' |
||||
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>::.ctor(!0, |
||||
!1, |
||||
!2) |
||||
IL_002b: box valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> |
||||
IL_0030: ret |
||||
} // end of method TupleTests::get_NotTargetTyping |
||||
|
||||
.method public hidebysig instance void |
||||
UseDict() cil managed |
||||
{ |
||||
// Code size 109 (0x6d) |
||||
.maxstack 3 |
||||
.locals init (string V_0, |
||||
bool V_1) |
||||
IL_0000: nop |
||||
IL_0001: ldarg.0 |
||||
IL_0002: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict |
||||
IL_0007: callvirt instance int32 class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Count() |
||||
IL_000c: ldc.i4.s 10 |
||||
IL_000e: cgt |
||||
IL_0010: stloc.1 |
||||
IL_0011: ldloc.1 |
||||
IL_0012: brfalse.s IL_0022 |
||||
|
||||
IL_0014: nop |
||||
IL_0015: ldarg.0 |
||||
IL_0016: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict |
||||
IL_001b: callvirt instance void class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::Clear() |
||||
IL_0020: nop |
||||
IL_0021: nop |
||||
IL_0022: ldarg.0 |
||||
IL_0023: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict |
||||
IL_0028: ldc.i4.1 |
||||
IL_0029: ldstr "abc" |
||||
IL_002e: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,string>::.ctor(!0, |
||||
!1) |
||||
IL_0033: callvirt instance !1 class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Item(!0) |
||||
IL_0038: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<string,int32>::Item1 |
||||
IL_003d: stloc.0 |
||||
IL_003e: ldloc.0 |
||||
IL_003f: call void [mscorlib]System.Console::WriteLine(string) |
||||
IL_0044: nop |
||||
IL_0045: ldloc.0 |
||||
IL_0046: call void [mscorlib]System.Console::WriteLine(string) |
||||
IL_004b: nop |
||||
IL_004c: ldarg.0 |
||||
IL_004d: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict |
||||
IL_0052: callvirt instance class [mscorlib]System.Collections.Generic.Dictionary`2/ValueCollection<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Values() |
||||
IL_0057: call class [mscorlib]System.Collections.Generic.List`1<!!0> [System.Core]System.Linq.Enumerable::ToList<valuetype [mscorlib]System.ValueTuple`2<string,int32>>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>) |
||||
IL_005c: call !!0 [System.Core]System.Linq.Enumerable::First<valuetype [mscorlib]System.ValueTuple`2<string,int32>>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>) |
||||
IL_0061: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<string,int32>::Item2 |
||||
IL_0066: call void [mscorlib]System.Console::WriteLine(int32) |
||||
IL_006b: nop |
||||
IL_006c: ret |
||||
} // end of method TupleTests::UseDict |
||||
|
||||
.method public hidebysig specialname rtspecialname |
||||
instance void .ctor() cil managed |
||||
{ |
||||
// Code size 8 (0x8) |
||||
.maxstack 8 |
||||
IL_0000: ldarg.0 |
||||
IL_0001: call instance void [mscorlib]System.Object::.ctor() |
||||
IL_0006: nop |
||||
IL_0007: ret |
||||
} // end of method TupleTests::.ctor |
||||
|
||||
.property instance int32 VT1Member() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_VT1Member() |
||||
} // end of property TupleTests::VT1Member |
||||
.property instance int32 AccessUnnamed8() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessUnnamed8() |
||||
} // end of property TupleTests::AccessUnnamed8 |
||||
.property instance int32 AccessNamed8() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessNamed8() |
||||
} // end of property TupleTests::AccessNamed8 |
||||
.property instance int32 AccessPartiallyNamed() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessPartiallyNamed() |
||||
} // end of property TupleTests::AccessPartiallyNamed |
||||
.property instance valuetype [mscorlib]System.ValueTuple`1<int32> |
||||
NewTuple1() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NewTuple1() |
||||
} // end of property TupleTests::NewTuple1 |
||||
.property instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
NewTuple2() |
||||
{ |
||||
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b.. |
||||
.get instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NewTuple2() |
||||
} // end of property TupleTests::NewTuple2 |
||||
.property instance object BoxedTuple10() |
||||
{ |
||||
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_BoxedTuple10() |
||||
} // end of property TupleTests::BoxedTuple10 |
||||
.property instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> |
||||
SwapUnnamed() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_SwapUnnamed() |
||||
} // end of property TupleTests::SwapUnnamed |
||||
.property instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> |
||||
SwapNamed2() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_SwapNamed2() |
||||
} // end of property TupleTests::SwapNamed2 |
||||
.property instance int32 TupleHash() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TupleHash() |
||||
} // end of property TupleTests::TupleHash |
||||
.property instance int32 TupleHash2() |
||||
{ |
||||
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TupleHash2() |
||||
} // end of property TupleTests::TupleHash2 |
||||
.property instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> |
||||
AccessRest() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessRest() |
||||
} // end of property TupleTests::AccessRest |
||||
.property instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> |
||||
TargetTyping() |
||||
{ |
||||
.get instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TargetTyping() |
||||
} // end of property TupleTests::TargetTyping |
||||
.property instance object NotTargetTyping() |
||||
{ |
||||
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NotTargetTyping() |
||||
} // end of property TupleTests::NotTargetTyping |
||||
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests |
||||
|
||||
|
||||
// ============================================================= |
||||
|
||||
// *********** DISASSEMBLY COMPLETE *********************** |
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2018 Daniel Grunwald
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; |
||||
|
||||
namespace ICSharpCode.Decompiler.CSharp.Syntax |
||||
{ |
||||
public class TupleExpression : Expression |
||||
{ |
||||
public AstNodeCollection<Expression> Elements { |
||||
get { return GetChildrenByRole(Roles.Expression); } |
||||
} |
||||
|
||||
public override void AcceptVisitor(IAstVisitor visitor) |
||||
{ |
||||
visitor.VisitTupleExpression(this); |
||||
} |
||||
|
||||
public override T AcceptVisitor<T>(IAstVisitor<T> visitor) |
||||
{ |
||||
return visitor.VisitTupleExpression(this); |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitTupleExpression(this, data); |
||||
} |
||||
|
||||
protected internal override bool DoMatch(AstNode other, Match match) |
||||
{ |
||||
return other is TupleExpression tuple |
||||
&& Elements.DoMatch(tuple.Elements, match); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,139 @@
@@ -0,0 +1,139 @@
|
||||
// Copyright (c) 2018 Daniel Grunwald
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Immutable; |
||||
using System.Linq; |
||||
using ICSharpCode.Decompiler.CSharp.Resolver; |
||||
using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; |
||||
using ICSharpCode.Decompiler.TypeSystem; |
||||
|
||||
namespace ICSharpCode.Decompiler.CSharp.Syntax |
||||
{ |
||||
public class TupleAstType : AstType |
||||
{ |
||||
public static readonly Role<TupleTypeElement> ElementRole = new Role<TupleTypeElement>("Element", TupleTypeElement.Null); |
||||
|
||||
public AstNodeCollection<TupleTypeElement> Elements { |
||||
get { return GetChildrenByRole(ElementRole); } |
||||
} |
||||
|
||||
public override void AcceptVisitor(IAstVisitor visitor) |
||||
{ |
||||
visitor.VisitTupleType(this); |
||||
} |
||||
|
||||
public override T AcceptVisitor<T>(IAstVisitor<T> visitor) |
||||
{ |
||||
return visitor.VisitTupleType(this); |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitTupleType(this, data); |
||||
} |
||||
|
||||
public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null) |
||||
{ |
||||
return new TupleTypeReference( |
||||
this.Elements.Select(e => e.Type.ToTypeReference(lookupMode, interningProvider)).ToImmutableArray(), |
||||
this.Elements.Select(e => e.Name).ToImmutableArray() |
||||
); |
||||
} |
||||
|
||||
protected internal override bool DoMatch(AstNode other, Match match) |
||||
{ |
||||
return other is TupleAstType o && Elements.DoMatch(o.Elements, match); |
||||
} |
||||
} |
||||
|
||||
public class TupleTypeElement : AstNode |
||||
{ |
||||
#region Null
|
||||
public new static readonly TupleTypeElement Null = new TupleTypeElement(); |
||||
|
||||
sealed class NullTupleTypeElement : TupleTypeElement |
||||
{ |
||||
public override bool IsNull { |
||||
get { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public override void AcceptVisitor(IAstVisitor visitor) |
||||
{ |
||||
visitor.VisitNullNode(this); |
||||
} |
||||
|
||||
public override T AcceptVisitor<T>(IAstVisitor<T> visitor) |
||||
{ |
||||
return visitor.VisitNullNode(this); |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitNullNode(this, data); |
||||
} |
||||
|
||||
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) |
||||
{ |
||||
return other == null || other.IsNull; |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
public AstType Type { |
||||
get { return GetChildByRole(Roles.Type); } |
||||
set { SetChildByRole(Roles.Type, value); } |
||||
} |
||||
|
||||
public string Name { |
||||
get { return GetChildByRole(Roles.Identifier).Name; } |
||||
set { SetChildByRole(Roles.Identifier, Identifier.Create(value)); } |
||||
} |
||||
|
||||
public Identifier NameToken { |
||||
get { return GetChildByRole(Roles.Identifier); } |
||||
set { SetChildByRole(Roles.Identifier, value); } |
||||
} |
||||
|
||||
public override NodeType NodeType => NodeType.Unknown; |
||||
|
||||
public override void AcceptVisitor(IAstVisitor visitor) |
||||
{ |
||||
visitor.VisitTupleTypeElement(this); |
||||
} |
||||
|
||||
public override T AcceptVisitor<T>(IAstVisitor<T> visitor) |
||||
{ |
||||
return visitor.VisitTupleTypeElement(this); |
||||
} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{ |
||||
return visitor.VisitTupleTypeElement(this, data); |
||||
} |
||||
|
||||
protected internal override bool DoMatch(AstNode other, Match match) |
||||
{ |
||||
return other is TupleTypeElement o |
||||
&& Type.DoMatch(o.Type, match) |
||||
&& MatchString(Name, o.Name); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,93 @@
@@ -0,0 +1,93 @@
|
||||
// Copyright (c) 2018 Daniel Grunwald
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.Text; |
||||
using ICSharpCode.Decompiler.TypeSystem; |
||||
|
||||
namespace ICSharpCode.Decompiler.IL |
||||
{ |
||||
class TupleTransform |
||||
{ |
||||
/// <summary>
|
||||
/// Matches an 'ldflda' instruction accessing a tuple element.
|
||||
///
|
||||
/// E.g. matches:
|
||||
/// <c>ldflda Item1(ldflda Rest(target))</c>
|
||||
/// </summary>
|
||||
public static bool MatchTupleFieldAccess(LdFlda inst, out IType tupleType, out ILInstruction target, out int position) |
||||
{ |
||||
tupleType = inst.Field.DeclaringType; |
||||
target = inst.Target; |
||||
if (!inst.Field.Name.StartsWith("Item", StringComparison.Ordinal)) { |
||||
position = 0; |
||||
return false; |
||||
} |
||||
if (!int.TryParse(inst.Field.Name.Substring(4), out position)) |
||||
return false; |
||||
if (!TupleType.IsTupleCompatible(tupleType, out _)) |
||||
return false; |
||||
while (target is LdFlda ldflda && ldflda.Field.Name == "Rest" && TupleType.IsTupleCompatible(ldflda.Field.DeclaringType, out _)) { |
||||
tupleType = ldflda.Field.DeclaringType; |
||||
target = ldflda.Target; |
||||
position += TupleType.RestPosition - 1; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Matches 'newobj TupleType(...)'.
|
||||
/// Takes care of flattening long tuples.
|
||||
/// </summary>
|
||||
public static bool MatchTupleConstruction(NewObj newobj, out ILInstruction[] arguments) |
||||
{ |
||||
arguments = null; |
||||
if (newobj == null) |
||||
return false; |
||||
if (!TupleType.IsTupleCompatible(newobj.Method.DeclaringType, out int elementCount)) |
||||
return false; |
||||
arguments = new ILInstruction[elementCount]; |
||||
int outIndex = 0; |
||||
while (elementCount >= TupleType.RestPosition) { |
||||
if (newobj.Arguments.Count != TupleType.RestPosition) |
||||
return false; |
||||
for (int pos = 1; pos < TupleType.RestPosition; pos++) { |
||||
arguments[outIndex++] = newobj.Arguments[pos-1]; |
||||
} |
||||
elementCount -= TupleType.RestPosition - 1; |
||||
Debug.Assert(outIndex + elementCount == arguments.Length); |
||||
newobj = newobj.Arguments.Last() as NewObj; |
||||
if (newobj == null) |
||||
return false; |
||||
if (!TupleType.IsTupleCompatible(newobj.Method.DeclaringType, out int restElementCount)) |
||||
return false; |
||||
if (restElementCount != elementCount) |
||||
return false; |
||||
} |
||||
Debug.Assert(outIndex + elementCount == arguments.Length); |
||||
if (newobj.Arguments.Count != elementCount) |
||||
return false; |
||||
for (int i = 0; i < elementCount; i++) { |
||||
arguments[outIndex++] = newobj.Arguments[i]; |
||||
} |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2018 Daniel Grunwald
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.Immutable; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Decompiler.TypeSystem; |
||||
using ICSharpCode.Decompiler.Util; |
||||
|
||||
namespace ICSharpCode.Decompiler.Semantics |
||||
{ |
||||
/// <summary>
|
||||
/// Resolve result for a C# 7 tuple literal.
|
||||
/// </summary>
|
||||
public class TupleResolveResult : ResolveResult |
||||
{ |
||||
public ImmutableArray<ResolveResult> Elements { get; } |
||||
|
||||
public TupleResolveResult(ICompilation compilation, |
||||
ImmutableArray<ResolveResult> elements, |
||||
ImmutableArray<string> elementNames = default(ImmutableArray<string>)) |
||||
: base(GetTupleType(compilation, elements, elementNames)) |
||||
{ |
||||
this.Elements = elements; |
||||
} |
||||
|
||||
public override IEnumerable<ResolveResult> GetChildResults() |
||||
{ |
||||
return Elements; |
||||
} |
||||
|
||||
static IType GetTupleType(ICompilation compilation, ImmutableArray<ResolveResult> elements, ImmutableArray<string> elementNames) |
||||
{ |
||||
if (elements.Any(e => e.Type.Kind == TypeKind.None || e.Type.Kind == TypeKind.Null)) |
||||
return SpecialType.NoType; |
||||
else |
||||
return new TupleType(compilation, elements.Select(e => e.Type).ToImmutableArray(), elementNames); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using ICSharpCode.Decompiler.TypeSystem.Implementation; |
||||
|
||||
namespace ICSharpCode.Decompiler.TypeSystem |
||||
{ |
||||
sealed class NormalizeTypeVisitor : TypeVisitor |
||||
{ |
||||
/// <summary>
|
||||
/// NormalizeTypeVisitor that does not normalize type parameters,
|
||||
/// but performs type erasure (object->dynamic; tuple->underlying type).
|
||||
/// </summary>
|
||||
internal static readonly NormalizeTypeVisitor TypeErasure = new NormalizeTypeVisitor { |
||||
ReplaceClassTypeParametersWithDummy = false, |
||||
ReplaceMethodTypeParametersWithDummy = false, |
||||
DynamicAndObject = true, |
||||
TupleToUnderlyingType = true |
||||
}; |
||||
|
||||
public bool ReplaceClassTypeParametersWithDummy = true; |
||||
public bool ReplaceMethodTypeParametersWithDummy = true; |
||||
public bool DynamicAndObject = true; |
||||
public bool TupleToUnderlyingType = true; |
||||
|
||||
public override IType VisitTypeParameter(ITypeParameter type) |
||||
{ |
||||
if (type.OwnerType == SymbolKind.Method && ReplaceMethodTypeParametersWithDummy) { |
||||
return DummyTypeParameter.GetMethodTypeParameter(type.Index); |
||||
} else if (type.OwnerType == SymbolKind.TypeDefinition && ReplaceClassTypeParametersWithDummy) { |
||||
return DummyTypeParameter.GetClassTypeParameter(type.Index); |
||||
} else { |
||||
return base.VisitTypeParameter(type); |
||||
} |
||||
} |
||||
|
||||
public override IType VisitTypeDefinition(ITypeDefinition type) |
||||
{ |
||||
if (DynamicAndObject && type.KnownTypeCode == KnownTypeCode.Object) { |
||||
// Instead of normalizing dynamic->object,
|
||||
// we do this the opposite direction, so that we don't need a compilation to find the object type.
|
||||
return SpecialType.Dynamic; |
||||
} |
||||
return base.VisitTypeDefinition(type); |
||||
} |
||||
|
||||
public override IType VisitTupleType(TupleType type) |
||||
{ |
||||
if (TupleToUnderlyingType) { |
||||
return type.UnderlyingType.AcceptVisitor(this); |
||||
} else { |
||||
return base.VisitTupleType(type); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,17 +1,380 @@
@@ -1,17 +1,380 @@
|
||||
using System; |
||||
// Copyright (c) 2018 Daniel Grunwald
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.Immutable; |
||||
using System.Diagnostics; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Decompiler.TypeSystem.Implementation; |
||||
using ICSharpCode.Decompiler.Util; |
||||
using Mono.Cecil; |
||||
|
||||
namespace ICSharpCode.Decompiler.TypeSystem |
||||
{ |
||||
public sealed class TupleType |
||||
public sealed class TupleType : AbstractType, ICompilationProvider |
||||
{ |
||||
public const int RestPosition = 8; |
||||
const int RestIndex = RestPosition - 1; |
||||
|
||||
public ICompilation Compilation { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying <c>System.ValueType</c> type.
|
||||
/// </summary>
|
||||
public ParameterizedType UnderlyingType { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the tuple elements.
|
||||
/// </summary>
|
||||
public ImmutableArray<IType> ElementTypes { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the names of the tuple elements.
|
||||
/// </summary>
|
||||
public ImmutableArray<string> ElementNames { get; } |
||||
|
||||
public ImmutableArray<IField> TupleElements { get; } |
||||
public TupleType(ICompilation compilation, ImmutableArray<IType> elementTypes, |
||||
ImmutableArray<string> elementNames = default(ImmutableArray<string>), |
||||
IAssembly valueTupleAssembly = null) |
||||
{ |
||||
this.Compilation = compilation; |
||||
this.UnderlyingType = CreateUnderlyingType(compilation, elementTypes, valueTupleAssembly); |
||||
this.ElementTypes = elementTypes; |
||||
if (elementNames.IsDefault) { |
||||
this.ElementNames = Enumerable.Repeat<string>(null, elementTypes.Length).ToImmutableArray(); |
||||
} else { |
||||
Debug.Assert(elementNames.Length == elementTypes.Length); |
||||
this.ElementNames = elementNames; |
||||
} |
||||
} |
||||
|
||||
static ParameterizedType CreateUnderlyingType(ICompilation compilation, ImmutableArray<IType> elementTypes, IAssembly valueTupleAssembly) |
||||
{ |
||||
int remainder = (elementTypes.Length - 1) % (RestPosition - 1) + 1; |
||||
Debug.Assert(remainder >= 1 && remainder < RestPosition); |
||||
int pos = elementTypes.Length - remainder; |
||||
var type = new ParameterizedType( |
||||
FindValueTupleType(compilation, valueTupleAssembly, remainder), |
||||
elementTypes.Slice(pos)); |
||||
while (pos > 0) { |
||||
pos -= (RestPosition - 1); |
||||
type = new ParameterizedType( |
||||
FindValueTupleType(compilation, valueTupleAssembly, RestPosition), |
||||
elementTypes.Slice(pos, RestPosition - 1).Concat(new[] { type })); |
||||
} |
||||
Debug.Assert(pos == 0); |
||||
return type; |
||||
} |
||||
|
||||
private static IType FindValueTupleType(ICompilation compilation, IAssembly valueTupleAssembly, int tpc) |
||||
{ |
||||
FullTypeName typeName = new TopLevelTypeName("System", "ValueTuple", tpc); |
||||
if (valueTupleAssembly != null) { |
||||
var typeDef = valueTupleAssembly.GetTypeDefinition(typeName); |
||||
if (typeDef != null) |
||||
return typeDef; |
||||
} |
||||
return compilation.FindType(typeName); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether the specified type is a valid underlying type for a tuple.
|
||||
/// Also returns true for tuple types themselves.
|
||||
/// </summary>
|
||||
public static bool IsTupleCompatible(IType type, out int tupleCardinality) |
||||
{ |
||||
switch (type.Kind) { |
||||
case TypeKind.Tuple: |
||||
tupleCardinality = ((TupleType)type).ElementTypes.Length; |
||||
return true; |
||||
case TypeKind.Class: |
||||
case TypeKind.Struct: |
||||
if (type.Namespace == "System" && type.Name == "ValueTuple") { |
||||
int tpc = type.TypeParameterCount; |
||||
if (tpc > 0 && tpc < RestPosition) { |
||||
tupleCardinality = tpc; |
||||
return true; |
||||
} else if (tpc == RestPosition && type is ParameterizedType pt) { |
||||
if (IsTupleCompatible(pt.TypeArguments[RestIndex], out tupleCardinality)) { |
||||
tupleCardinality += RestPosition - 1; |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
tupleCardinality = 0; |
||||
return false; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Construct a tuple type (without element names) from the given underlying type.
|
||||
/// Returns null if the input is not a valid underlying type.
|
||||
/// </summary>
|
||||
public static TupleType FromUnderlyingType(ICompilation compilation, IType type) |
||||
{ |
||||
var elementTypes = GetTupleElementTypes(type); |
||||
if (elementTypes.Length > 0) { |
||||
return new TupleType( |
||||
compilation, |
||||
elementTypes, |
||||
valueTupleAssembly: type.GetDefinition()?.ParentAssembly |
||||
); |
||||
} else { |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the tuple element types from a tuple type or tuple underlying type.
|
||||
/// </summary>
|
||||
public static ImmutableArray<IType> GetTupleElementTypes(IType tupleType) |
||||
{ |
||||
List<IType> output = null; |
||||
if (Collect(tupleType)) { |
||||
return output.ToImmutableArray(); |
||||
} else { |
||||
return default(ImmutableArray<IType>); |
||||
} |
||||
|
||||
bool Collect(IType type) |
||||
{ |
||||
switch (type.Kind) { |
||||
case TypeKind.Tuple: |
||||
if (output == null) |
||||
output = new List<IType>(); |
||||
output.AddRange(((TupleType)type).ElementTypes); |
||||
return true; |
||||
case TypeKind.Class: |
||||
case TypeKind.Struct: |
||||
if (type.Namespace == "System" && type.Name == "ValueTuple") { |
||||
if (output == null) |
||||
output = new List<IType>(); |
||||
int tpc = type.TypeParameterCount; |
||||
if (tpc > 0 && tpc < RestPosition) { |
||||
output.AddRange(type.TypeArguments); |
||||
return true; |
||||
} else if (tpc == RestPosition) { |
||||
output.AddRange(type.TypeArguments.Take(RestPosition - 1)); |
||||
return Collect(type.TypeArguments[RestIndex]); |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public override TypeKind Kind => TypeKind.Tuple; |
||||
public override bool? IsReferenceType => UnderlyingType.IsReferenceType; |
||||
public override int TypeParameterCount => 0; |
||||
public override IReadOnlyList<ITypeParameter> TypeParameters => EmptyList<ITypeParameter>.Instance; |
||||
public override IReadOnlyList<IType> TypeArguments => EmptyList<IType>.Instance; |
||||
public override IEnumerable<IType> DirectBaseTypes => UnderlyingType.DirectBaseTypes; |
||||
public override string FullName => UnderlyingType.FullName; |
||||
public override string Name => UnderlyingType.Name; |
||||
public override string ReflectionName => UnderlyingType.ReflectionName; |
||||
public override string Namespace => UnderlyingType.Namespace; |
||||
|
||||
public override bool Equals(IType other) |
||||
{ |
||||
var o = other as TupleType; |
||||
if (o == null) |
||||
return false; |
||||
if (!UnderlyingType.Equals(o.UnderlyingType)) |
||||
return false; |
||||
return UnderlyingType.Equals(o.UnderlyingType) |
||||
&& ElementNames.SequenceEqual(o.ElementNames); |
||||
} |
||||
|
||||
public override int GetHashCode() |
||||
{ |
||||
unchecked { |
||||
int hash = UnderlyingType.GetHashCode(); |
||||
foreach (string name in ElementNames) { |
||||
hash *= 31; |
||||
hash += name != null ? name.GetHashCode() : 0; |
||||
} |
||||
return hash; |
||||
} |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
StringBuilder b = new StringBuilder(); |
||||
b.Append('('); |
||||
for (int i = 0; i < ElementTypes.Length; i++) { |
||||
if (i > 0) |
||||
b.Append(", "); |
||||
b.Append(ElementTypes[i]); |
||||
if (ElementNames[i] != null) { |
||||
b.Append(' '); |
||||
b.Append(ElementNames[i]); |
||||
} |
||||
} |
||||
b.Append(')'); |
||||
return b.ToString(); |
||||
} |
||||
|
||||
public override IType AcceptVisitor(TypeVisitor visitor) |
||||
{ |
||||
return visitor.VisitTupleType(this); |
||||
} |
||||
|
||||
public override IType VisitChildren(TypeVisitor visitor) |
||||
{ |
||||
IType[] newElementTypes = null; |
||||
for (int i = 0; i < ElementTypes.Length; i++) { |
||||
IType type = ElementTypes[i]; |
||||
var newType = type.AcceptVisitor(visitor); |
||||
if (newType != type) { |
||||
if (newElementTypes == null) { |
||||
newElementTypes = ElementTypes.ToArray(); |
||||
} |
||||
newElementTypes[i] = newType; |
||||
} |
||||
} |
||||
if (newElementTypes != null) { |
||||
return new TupleType(this.Compilation, newElementTypes.ToImmutableArray(), this.ElementNames, |
||||
this.GetDefinition()?.ParentAssembly); |
||||
} else { |
||||
return this; |
||||
} |
||||
} |
||||
|
||||
public override IEnumerable<IMethod> GetAccessors(Predicate<IUnresolvedMethod> filter = null, GetMemberOptions options = GetMemberOptions.None) |
||||
{ |
||||
return UnderlyingType.GetAccessors(filter, options); |
||||
} |
||||
|
||||
public override IEnumerable<IMethod> GetConstructors(Predicate<IUnresolvedMethod> filter = null, GetMemberOptions options = GetMemberOptions.IgnoreInheritedMembers) |
||||
{ |
||||
// CS8181 'new' cannot be used with tuple type. Use a tuple literal expression instead.
|
||||
return EmptyList<IMethod>.Instance; |
||||
} |
||||
|
||||
public override ITypeDefinition GetDefinition() |
||||
{ |
||||
return UnderlyingType.GetDefinition(); |
||||
} |
||||
|
||||
public override IEnumerable<IEvent> GetEvents(Predicate<IUnresolvedEvent> filter = null, GetMemberOptions options = GetMemberOptions.None) |
||||
{ |
||||
return UnderlyingType.GetEvents(filter, options); |
||||
} |
||||
|
||||
public override IEnumerable<IField> GetFields(Predicate<IUnresolvedField> filter = null, GetMemberOptions options = GetMemberOptions.None) |
||||
{ |
||||
// The fields from the underlying type (Item1..Item7 and Rest)
|
||||
foreach (var field in UnderlyingType.GetFields(filter, options)) { |
||||
yield return field; |
||||
} |
||||
/*for (int i = 0; i < ElementTypes.Length; i++) { |
||||
var type = ElementTypes[i]; |
||||
var name = ElementNames[i]; |
||||
int pos = i + 1; |
||||
string itemName = "Item" + pos; |
||||
if (name != itemName && name != null) |
||||
yield return MakeField(type, name); |
||||
if (pos >= RestPosition) |
||||
yield return MakeField(type, itemName); |
||||
}*/ |
||||
} |
||||
|
||||
/*private IField MakeField(IType type, string name) |
||||
{ |
||||
var f = new DefaultUnresolvedField(); |
||||
f.ReturnType = SpecialType.UnknownType; |
||||
f.Name = name; |
||||
return new TupleElementField(f, Compilation.TypeResolveContext); |
||||
}*/ |
||||
|
||||
public override IEnumerable<IMethod> GetMethods(Predicate<IUnresolvedMethod> filter = null, GetMemberOptions options = GetMemberOptions.None) |
||||
{ |
||||
return UnderlyingType.GetMethods(filter, options); |
||||
} |
||||
|
||||
public override IEnumerable<IMethod> GetMethods(IReadOnlyList<IType> typeArguments, Predicate<IUnresolvedMethod> filter = null, GetMemberOptions options = GetMemberOptions.None) |
||||
{ |
||||
return UnderlyingType.GetMethods(typeArguments, filter, options); |
||||
} |
||||
|
||||
public override IEnumerable<IType> GetNestedTypes(Predicate<ITypeDefinition> filter = null, GetMemberOptions options = GetMemberOptions.None) |
||||
{ |
||||
return UnderlyingType.GetNestedTypes(filter, options); |
||||
} |
||||
|
||||
public override IEnumerable<IType> GetNestedTypes(IReadOnlyList<IType> typeArguments, Predicate<ITypeDefinition> filter = null, GetMemberOptions options = GetMemberOptions.None) |
||||
{ |
||||
return UnderlyingType.GetNestedTypes(typeArguments, filter, options); |
||||
} |
||||
|
||||
public override IEnumerable<IProperty> GetProperties(Predicate<IUnresolvedProperty> filter = null, GetMemberOptions options = GetMemberOptions.None) |
||||
{ |
||||
return UnderlyingType.GetProperties(filter, options); |
||||
} |
||||
} |
||||
|
||||
public class TupleTypeReference : ITypeReference |
||||
{ |
||||
/// <summary>
|
||||
/// Gets the types of the tuple elements.
|
||||
/// </summary>
|
||||
public ImmutableArray<ITypeReference> ElementTypes { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the names of the tuple elements.
|
||||
/// </summary>
|
||||
public ImmutableArray<string> ElementNames { get; } |
||||
|
||||
public IAssemblyReference ValueTupleAssembly { get; } |
||||
|
||||
public TupleTypeReference(ImmutableArray<ITypeReference> elementTypes) |
||||
{ |
||||
this.ElementTypes = elementTypes; |
||||
} |
||||
|
||||
public TupleTypeReference(ImmutableArray<ITypeReference> elementTypes, |
||||
ImmutableArray<string> elementNames = default(ImmutableArray<string>), |
||||
IAssemblyReference valueTupleAssembly = null) |
||||
{ |
||||
this.ValueTupleAssembly = valueTupleAssembly; |
||||
this.ElementTypes = elementTypes; |
||||
this.ElementNames = elementNames; |
||||
} |
||||
|
||||
public IType Resolve(ITypeResolveContext context) |
||||
{ |
||||
return new TupleType(context.Compilation, |
||||
ElementTypes.Select(t => t.Resolve(context)).ToImmutableArray(), |
||||
ElementNames, |
||||
ValueTupleAssembly?.Resolve(context) |
||||
); |
||||
} |
||||
} |
||||
|
||||
public static class TupleTypeExtensions |
||||
{ |
||||
public static IType TupleUnderlyingTypeOrSelf(this IType type) |
||||
{ |
||||
return (type as TupleType)?.UnderlyingType ?? type; |
||||
} |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue