mirror of https://github.com/icsharpcode/ILSpy.git
186 changed files with 102967 additions and 8046 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,940 @@
@@ -0,0 +1,940 @@
|
||||
// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// 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; |
||||
using ICSharpCode.Decompiler.CSharp.Resolver; |
||||
using ICSharpCode.Decompiler.Semantics; |
||||
using ICSharpCode.Decompiler.Tests.TypeSystem; |
||||
using ICSharpCode.Decompiler.TypeSystem; |
||||
using ICSharpCode.Decompiler.TypeSystem.Implementation; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Decompiler.Tests.Semantics |
||||
{ |
||||
using dynamic = ICSharpCode.Decompiler.TypeSystem.ReflectionHelper.Dynamic; |
||||
using C = Conversion; |
||||
|
||||
[TestFixture, Parallelizable(ParallelScope.All)] |
||||
public class ExplicitConversionsTest |
||||
{ |
||||
CSharpConversions conversions; |
||||
ICompilation compilation; |
||||
|
||||
[OneTimeSetUp] |
||||
public void SetUp() |
||||
{ |
||||
compilation = new SimpleCompilation(TypeSystemLoaderTests.TestAssembly, |
||||
TypeSystemLoaderTests.Mscorlib, |
||||
TypeSystemLoaderTests.SystemCore); |
||||
conversions = new CSharpConversions(compilation); |
||||
} |
||||
|
||||
Conversion ExplicitConversion(Type from, Type to) |
||||
{ |
||||
IType from2 = compilation.FindType(from); |
||||
IType to2 = compilation.FindType(to); |
||||
return conversions.ExplicitConversion(from2, to2); |
||||
} |
||||
|
||||
[Test] |
||||
public void PointerConversion() |
||||
{ |
||||
Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(int*), typeof(short))); |
||||
Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(short), typeof(void*))); |
||||
|
||||
Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(void*), typeof(int*))); |
||||
Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(long*), typeof(byte*))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionFromDynamic() |
||||
{ |
||||
// Explicit dynamic conversion is for resolve results only;
|
||||
// otherwise it's an explicit reference / unboxing conversion
|
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic), typeof(string))); |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(dynamic), typeof(int))); |
||||
|
||||
var dynamicRR = new ResolveResult(SpecialType.Dynamic); |
||||
Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(string)))); |
||||
Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(int)))); |
||||
} |
||||
|
||||
[Test] |
||||
public void NumericConversions() |
||||
{ |
||||
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(sbyte), typeof(uint))); |
||||
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(sbyte), typeof(char))); |
||||
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(byte), typeof(char))); |
||||
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(byte), typeof(sbyte))); |
||||
// if an implicit conversion exists, ExplicitConversion() should return that
|
||||
Assert.AreEqual(C.ImplicitNumericConversion, ExplicitConversion(typeof(byte), typeof(int))); |
||||
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(double), typeof(float))); |
||||
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(double), typeof(decimal))); |
||||
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(decimal), typeof(double))); |
||||
Assert.AreEqual(C.ImplicitNumericConversion, ExplicitConversion(typeof(int), typeof(decimal))); |
||||
|
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(bool), typeof(int))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(int), typeof(bool))); |
||||
} |
||||
|
||||
[Test] |
||||
public void EnumerationConversions() |
||||
{ |
||||
var explicitEnumerationConversion = C.EnumerationConversion(false, false); |
||||
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(sbyte), typeof(StringComparison))); |
||||
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(char), typeof(StringComparison))); |
||||
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(int), typeof(StringComparison))); |
||||
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(decimal), typeof(StringComparison))); |
||||
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(char))); |
||||
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(int))); |
||||
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(decimal))); |
||||
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(StringSplitOptions))); |
||||
} |
||||
|
||||
[Test] |
||||
public void NullableConversion_BasedOnIdentityConversion() |
||||
{ |
||||
Assert.AreEqual(C.IdentityConversion, ExplicitConversion(typeof(ArraySegment<dynamic>?), typeof(ArraySegment<object>?))); |
||||
Assert.AreEqual(C.ImplicitNullableConversion, ExplicitConversion(typeof(ArraySegment<dynamic>), typeof(ArraySegment<object>?))); |
||||
Assert.AreEqual(C.ExplicitNullableConversion, ExplicitConversion(typeof(ArraySegment<dynamic>?), typeof(ArraySegment<object>))); |
||||
} |
||||
|
||||
[Test] |
||||
public void NullableConversion_BasedOnImplicitNumericConversion() |
||||
{ |
||||
Assert.AreEqual(C.ImplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(long?))); |
||||
Assert.AreEqual(C.ImplicitLiftedNumericConversion, ExplicitConversion(typeof(int), typeof(long?))); |
||||
Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(long))); |
||||
} |
||||
|
||||
[Test] |
||||
public void NullableConversion_BasedOnImplicitEnumerationConversion() |
||||
{ |
||||
ResolveResult zero = new ConstantResolveResult(compilation.FindType(KnownTypeCode.Int32), 0); |
||||
ResolveResult one = new ConstantResolveResult(compilation.FindType(KnownTypeCode.Int32), 1); |
||||
Assert.AreEqual(C.EnumerationConversion(true, true), conversions.ExplicitConversion(zero, compilation.FindType(typeof(StringComparison?)))); |
||||
Assert.AreEqual(C.EnumerationConversion(false, true), conversions.ExplicitConversion(one, compilation.FindType(typeof(StringComparison?)))); |
||||
} |
||||
|
||||
[Test] |
||||
public void NullableConversion_BasedOnExplicitNumericConversion() |
||||
{ |
||||
Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(short?))); |
||||
Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int), typeof(short?))); |
||||
Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(short))); |
||||
} |
||||
|
||||
[Test] |
||||
public void NullableConversion_BasedOnExplicitEnumerationConversion() |
||||
{ |
||||
C c = C.EnumerationConversion(false, true); // c = explicit lifted enumeration conversion
|
||||
Assert.AreEqual(c, ExplicitConversion(typeof(int?), typeof(StringComparison?))); |
||||
Assert.AreEqual(c, ExplicitConversion(typeof(int), typeof(StringComparison?))); |
||||
Assert.AreEqual(c, ExplicitConversion(typeof(int?), typeof(StringComparison))); |
||||
|
||||
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(int?))); |
||||
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison), typeof(int?))); |
||||
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(int))); |
||||
|
||||
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(StringSplitOptions?))); |
||||
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison), typeof(StringSplitOptions?))); |
||||
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(StringSplitOptions))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitReferenceConversion_SealedClass() |
||||
{ |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object), typeof(string))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<char>), typeof(string))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<int>), typeof(string))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<object>), typeof(string))); |
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(string), typeof(IEnumerable<char>))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(string), typeof(IEnumerable<int>))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(string), typeof(IEnumerable<object>))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitReferenceConversion_NonSealedClass() |
||||
{ |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object), typeof(List<string>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(List<string>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(List<string>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<int>), typeof(List<string>))); |
||||
|
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(List<string>), typeof(IEnumerable<object>))); |
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(List<string>), typeof(IEnumerable<string>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(List<string>), typeof(IEnumerable<int>))); |
||||
|
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(List<string>), typeof(List<object>))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(List<string>), typeof(List<int>))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitReferenceConversion_Interfaces() |
||||
{ |
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(IEnumerable<object>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<int>), typeof(IEnumerable<object>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(IEnumerable<string>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(IEnumerable<int>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(IConvertible))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitReferenceConversion_Arrays() |
||||
{ |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object[]), typeof(string[]))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic[]), typeof(string[]))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(object[]), typeof(object[,]))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(object[]), typeof(int[]))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(short[]), typeof(int[]))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Array), typeof(int[]))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitReferenceConversion_InterfaceToArray() |
||||
{ |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(ICloneable), typeof(int[]))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(string[]))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(string[]))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(object[]))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(dynamic[]))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<int>), typeof(int[]))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<string>), typeof(object[,]))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<short>), typeof(object[]))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitReferenceConversion_ArrayToInterface() |
||||
{ |
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(int[]), typeof(ICloneable))); |
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(string[]), typeof(IEnumerable<string>))); |
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(string[]), typeof(IEnumerable<object>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object[]), typeof(IEnumerable<string>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic[]), typeof(IEnumerable<string>))); |
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(int[]), typeof(IEnumerable<int>))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(object[,]), typeof(IEnumerable<string>))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(object[]), typeof(IEnumerable<short>))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitReferenceConversion_Delegates() |
||||
{ |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(MulticastDelegate), typeof(Action))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Delegate), typeof(Action))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(ICloneable), typeof(Action))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(System.Threading.ThreadStart), typeof(Action))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitReferenceConversion_GenericDelegates() |
||||
{ |
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(Action<object>), typeof(Action<string>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Action<string>), typeof(Action<object>))); |
||||
|
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Func<object>), typeof(Func<string>))); |
||||
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(Func<string>), typeof(Func<object>))); |
||||
|
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Action<IFormattable>), typeof(Action<IConvertible>))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(Action<IFormattable>), typeof(Action<int>))); |
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Action<string>), typeof(Action<IEnumerable<int>>))); |
||||
|
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Func<IFormattable>), typeof(Func<IConvertible>))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(Func<IFormattable>), typeof(Func<int>))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(Func<string>), typeof(Func<IEnumerable<int>>))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(Func<string>), typeof(Func<IEnumerable<int>>))); |
||||
} |
||||
|
||||
[Test] |
||||
public void UnboxingConversion() |
||||
{ |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(int))); |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(decimal))); |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(ValueType), typeof(int))); |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(IFormattable), typeof(int))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<object>), typeof(int))); |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(Enum), typeof(StringComparison))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(Enum), typeof(int))); |
||||
} |
||||
|
||||
[Test] |
||||
public void LiftedUnboxingConversion() |
||||
{ |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(int?))); |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(decimal?))); |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(ValueType), typeof(int?))); |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(IFormattable), typeof(int?))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<object>), typeof(int?))); |
||||
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(Enum), typeof(StringComparison?))); |
||||
Assert.AreEqual(C.None, ExplicitConversion(typeof(Enum), typeof(int?))); |
||||
} |
||||
|
||||
/* TODO: we should probably revive these tests somehow |
||||
Conversion ResolveCast(string program) |
||||
{ |
||||
return Resolve<ConversionResolveResult>(program).Conversion; |
||||
} |
||||
|
||||
[Test] |
||||
public void ObjectToTypeParameter() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T>(object o) { |
||||
T t = $(T)o$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.UnboxingConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void UnrelatedClassToTypeParameter() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T>(string o) { |
||||
T t = $(T)o$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.None, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IntefaceToTypeParameter() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T>(IDisposable o) { |
||||
T t = $(T)o$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.UnboxingConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterToInterface() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T>(T t) { |
||||
IDisposable d = $(IDisposable)t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.BoxingConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ValueTypeToTypeParameter() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T>(ValueType o) where T : struct { |
||||
T t = $(T)o$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.UnboxingConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void InvalidTypeParameterConversion() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T, U>(T t) { |
||||
U u = $(U)t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.None, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterConversion1() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T, U>(T t) where T : U { |
||||
U u = $(U)t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.BoxingConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterConversion1Array() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T, U>(T[] t) where T : U { |
||||
U[] u = $(U[])t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.None, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterConversion2() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T, U>(T t) where U : T { |
||||
U u = $(U)t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.UnboxingConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterConversion2Array() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T, U>(T[] t) where U : T { |
||||
U[] u = $(U[])t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.None, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ImplicitTypeParameterConversionWithClassConstraint() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T, U>(T t) where T : class where U : class, T { |
||||
U u = $(U)t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ImplicitTypeParameterArrayConversionWithClassConstraint() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T, U>(T[] t) where T : class where U : class, T { |
||||
U[] u = $(U[])t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ImplicitTypeParameterConversionWithClassConstraintOnlyOnT() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T, U>(T t) where U : class, T { |
||||
U u = $(U)t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ImplicitTypeParameterArrayConversionWithClassConstraintOnlyOnT() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public void M<T, U>(T[] t) where U : class, T { |
||||
U[] u = $(U[])t$; |
||||
} |
||||
}";
|
||||
Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program)); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleUserDefinedConversion() |
||||
{ |
||||
var rr = Resolve<ConversionResolveResult>(@"
|
||||
class C1 {} |
||||
class C2 { |
||||
public static explicit operator C1(C2 c2) { |
||||
return null; |
||||
} |
||||
} |
||||
class C { |
||||
public void M() { |
||||
var c2 = new C2(); |
||||
C1 c1 = $(C1)c2$; |
||||
} |
||||
}");
|
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("op_Explicit", rr.Conversion.Method.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitReferenceConversionFollowedByUserDefinedConversion() |
||||
{ |
||||
var rr = Resolve<ConversionResolveResult>(@"
|
||||
class B {} |
||||
class S : B {} |
||||
class T { |
||||
public static explicit operator T(S s) { return null; } |
||||
} |
||||
class Test { |
||||
void Run(B b) { |
||||
T t = $(T)b$; |
||||
} |
||||
}");
|
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("B", rr.Input.Type.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void ImplicitUserDefinedConversionFollowedByExplicitNumericConversion() |
||||
{ |
||||
var rr = Resolve<ConversionResolveResult>(@"
|
||||
struct T { |
||||
public static implicit operator float(T t) { return 0; } |
||||
} |
||||
class Test { |
||||
void Run(T t) { |
||||
int x = $(int)t$; |
||||
} |
||||
}");
|
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
// even though the user-defined conversion is implicit, the combined conversion is explicit
|
||||
Assert.IsTrue(rr.Conversion.IsExplicit); |
||||
} |
||||
|
||||
[Test] |
||||
public void BothDirectConversionAndBaseClassConversionAvailable() |
||||
{ |
||||
var rr = Resolve<ConversionResolveResult>(@"
|
||||
class B {} |
||||
class S : B {} |
||||
class T { |
||||
public static explicit operator T(S s) { return null; } |
||||
public static explicit operator T(B b) { return null; } |
||||
} |
||||
class Test { |
||||
void Run(B b) { |
||||
T t = $(T)b$; |
||||
} |
||||
}");
|
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("b", rr.Conversion.Method.Parameters.Single().Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_PicksExactSourceTypeIfPossible() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator Convertible(int i) {return new Convertible(); } |
||||
public static explicit operator Convertible(short s) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(Convertible)33$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("i", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_PicksMostEncompassedSourceTypeIfPossible() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator Convertible(long l) {return new Convertible(); } |
||||
public static explicit operator Convertible(uint ui) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(Convertible)(ushort)33$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("ui", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_PicksMostEncompassingSourceType() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator Convertible(int i) {return new Convertible(); } |
||||
public static explicit operator Convertible(ushort us) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(Convertible)(long)33$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("i", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_NoMostEncompassingSourceTypeIsInvalid() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator Convertible(uint i) {return new Convertible(); } |
||||
public static explicit operator Convertible(short us) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(Convertible)(long)33$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsFalse(rr.Conversion.IsValid); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_PicksExactTargetTypeIfPossible() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator int(Convertible i) {return 0; } |
||||
public static explicit operator short(Convertible s) {return 0; } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(int)new Convertible()$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("i", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_PicksMostEncompassingTargetTypeIfPossible() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator int(Convertible i) {return 0; } |
||||
public static explicit operator ushort(Convertible us) {return 0; } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(ulong)new Convertible()$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("us", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_PicksMostEncompassedTargetType() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator long(Convertible l) { return 0; } |
||||
public static explicit operator uint(Convertible ui) { return 0; } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(ushort)new Convertible()$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("ui", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_NoMostEncompassedTargetTypeIsInvalid() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator ulong(Convertible l) { return 0; } |
||||
public static explicit operator int(Convertible ui) { return 0; } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(ushort)new Convertible()$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsFalse(rr.Conversion.IsValid); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_AmbiguousIsInvalid() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible1 { |
||||
public static explicit operator Convertible2(Convertible1 c) {return 0; } |
||||
} |
||||
class Convertible2 { |
||||
public static explicit operator Convertible2(Convertible1 c) {return 0; } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(Convertible2)new Convertible1()$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsFalse(rr.Conversion.IsValid); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_Lifted() |
||||
{ |
||||
string program = @"using System;
|
||||
struct Convertible { |
||||
public static explicit operator Convertible(int i) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M(int? i) { |
||||
a = $(Convertible?)i$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.IsTrue(rr.Conversion.IsLifted); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversionFollowedByImplicitNullableConversion() |
||||
{ |
||||
string program = @"using System;
|
||||
struct Convertible { |
||||
public static explicit operator Convertible(int i) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M(int i) { |
||||
a = $(Convertible?)i$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.IsFalse(rr.Conversion.IsLifted); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_ExplicitNullable_ThenUserDefined() |
||||
{ |
||||
string program = @"using System;
|
||||
struct Convertible { |
||||
public static explicit operator Convertible(int i) {return new Convertible(); } |
||||
public static explicit operator Convertible?(int? ni) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M(int? i) { |
||||
a = $(Convertible)i$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.IsFalse(rr.Conversion.IsLifted); |
||||
Assert.AreEqual("i", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_DefinedNullableTakesPrecedenceOverLifted() |
||||
{ |
||||
string program = @"using System;
|
||||
struct Convertible { |
||||
public static explicit operator Convertible(int i) {return new Convertible(); } |
||||
public static explicit operator Convertible?(int? ni) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
a = $(Convertible?)(int?)33$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.IsFalse(rr.Conversion.IsLifted); |
||||
Assert.AreEqual("ni", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_UIntConstant() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator Convertible(long l) {return new Convertible(); } |
||||
public static explicit operator Convertible(uint ui) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
var a = $(Convertible)33$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("ui", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_NullableUIntConstant() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static explicit operator Convertible(long? l) {return new Convertible(); } |
||||
public static explicit operator Convertible(uint? ui) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
Convertible a = $(Convertible)33$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("ui", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UseDefinedExplicitConversion_Lifted() |
||||
{ |
||||
string program = @"
|
||||
struct Convertible { |
||||
public static explicit operator Convertible(int i) { return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M(int? i) { |
||||
a = $(Convertible?)i$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.IsTrue(rr.Conversion.IsLifted); |
||||
Assert.IsTrue(rr.Input is LocalResolveResult); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_Short_Or_NullableByte_Target() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public static explicit operator short(Test s) { return 0; } |
||||
public static explicit operator byte?(Test b) { return 0; } |
||||
} |
||||
class Program { |
||||
public static void Main(string[] args) |
||||
{ |
||||
int? x = $(int?)new Test()$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("System.Int16", rr.Conversion.Method.ReturnType.FullName); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_Byte_Or_NullableShort_Target() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
public static explicit operator byte(Test b) { return 0; } |
||||
public static explicit operator short?(Test s) { return 0; } |
||||
} |
||||
class Program { |
||||
public static void Main(string[] args) |
||||
{ |
||||
int? x = $(int?)new Test()$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("s", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExplicitConversionOperatorsCanOverrideApplicableImplicitOnes() |
||||
{ |
||||
string program = @"
|
||||
struct Convertible { |
||||
public static explicit operator int(Convertible ci) {return 0; } |
||||
public static implicit operator short(Convertible cs) {return 0; } |
||||
} |
||||
class Test { |
||||
static void Main() { |
||||
int i = $(int)new Convertible()$; // csc uses the explicit conversion operator
|
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.IsUserDefined); |
||||
Assert.AreEqual("ci", rr.Conversion.Method.Parameters[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_ConversionBeforeUserDefinedOperatorIsCorrect() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static implicit operator Convertible(int l) {return new Convertible(); } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
long i = 33; |
||||
Convertible a = $(Convertible)i$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.ConversionBeforeUserDefinedOperator.IsValid); |
||||
Assert.IsTrue(rr.Conversion.ConversionBeforeUserDefinedOperator.IsExplicit); |
||||
Assert.IsTrue(rr.Conversion.ConversionBeforeUserDefinedOperator.IsNumericConversion); |
||||
Assert.IsTrue(rr.Conversion.ConversionAfterUserDefinedOperator.IsIdentityConversion); |
||||
} |
||||
|
||||
[Test] |
||||
public void UserDefinedExplicitConversion_ConversionAfterUserDefinedOperatorIsCorrect() |
||||
{ |
||||
string program = @"using System;
|
||||
class Convertible { |
||||
public static implicit operator long(Convertible i) {return 0; } |
||||
} |
||||
class Test { |
||||
public void M() { |
||||
int a = $(int)new Convertible()$; |
||||
} |
||||
}";
|
||||
var rr = Resolve<ConversionResolveResult>(program); |
||||
Assert.IsTrue(rr.Conversion.IsValid); |
||||
Assert.IsTrue(rr.Conversion.ConversionBeforeUserDefinedOperator.IsIdentityConversion); |
||||
Assert.IsTrue(rr.Conversion.ConversionAfterUserDefinedOperator.IsValid); |
||||
Assert.IsTrue(rr.Conversion.ConversionAfterUserDefinedOperator.IsExplicit); |
||||
Assert.IsTrue(rr.Conversion.ConversionAfterUserDefinedOperator.IsNumericConversion); |
||||
}*/ |
||||
} |
||||
} |
@ -0,0 +1,412 @@
@@ -0,0 +1,412 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// 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; |
||||
using System.Reflection; |
||||
|
||||
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty |
||||
{ |
||||
public class Switch |
||||
{ |
||||
public class SetProperty |
||||
{ |
||||
public readonly PropertyInfo Property; |
||||
private int _set; |
||||
|
||||
public int Set { |
||||
get { |
||||
return _set; |
||||
} |
||||
|
||||
set { |
||||
_set = value; |
||||
} |
||||
} |
||||
|
||||
public SetProperty(PropertyInfo property) |
||||
{ |
||||
Property = property; |
||||
} |
||||
} |
||||
|
||||
public enum State |
||||
{ |
||||
False, |
||||
True, |
||||
Null |
||||
} |
||||
|
||||
public static string SparseIntegerSwitch(int i) |
||||
{ |
||||
Console.WriteLine("SparseIntegerSwitch: " + i); |
||||
switch (i) { |
||||
case -10000000: |
||||
return "-10 mln"; |
||||
case -100: |
||||
return "-hundred"; |
||||
case -1: |
||||
return "-1"; |
||||
case 0: |
||||
return "0"; |
||||
case 1: |
||||
return "1"; |
||||
case 2: |
||||
return "2"; |
||||
case 4: |
||||
return "4"; |
||||
case 100: |
||||
return "hundred"; |
||||
case 10000: |
||||
return "ten thousand"; |
||||
case 10001: |
||||
return "ten thousand and one"; |
||||
case int.MaxValue: |
||||
return "int.MaxValue"; |
||||
default: |
||||
return "something else"; |
||||
} |
||||
} |
||||
|
||||
public static void SwitchOverInt(int i) |
||||
{ |
||||
switch (i) { |
||||
case 0: |
||||
Console.WriteLine("zero"); |
||||
break; |
||||
case 5: |
||||
Console.WriteLine("five"); |
||||
break; |
||||
case 10: |
||||
Console.WriteLine("ten"); |
||||
break; |
||||
case 15: |
||||
Console.WriteLine("fifteen"); |
||||
break; |
||||
case 20: |
||||
Console.WriteLine("twenty"); |
||||
break; |
||||
case 25: |
||||
Console.WriteLine("twenty-five"); |
||||
break; |
||||
case 30: |
||||
Console.WriteLine("thirty"); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
public static string ShortSwitchOverString(string text) |
||||
{ |
||||
Console.WriteLine("ShortSwitchOverString: " + text); |
||||
switch (text) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
return "Text2"; |
||||
case "Third case": |
||||
return "Text3"; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} |
||||
|
||||
public static string ShortSwitchOverStringWithNullCase(string text) |
||||
{ |
||||
Console.WriteLine("ShortSwitchOverStringWithNullCase: " + text); |
||||
switch (text) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
return "Text2"; |
||||
case null: |
||||
return "null"; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} |
||||
|
||||
public static string SwitchOverString1(string text) |
||||
{ |
||||
Console.WriteLine("SwitchOverString1: " + text); |
||||
switch (text) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
case "2nd case": |
||||
return "Text2"; |
||||
case "Third case": |
||||
return "Text3"; |
||||
case "Fourth case": |
||||
return "Text4"; |
||||
case "Fifth case": |
||||
return "Text5"; |
||||
case "Sixth case": |
||||
return "Text6"; |
||||
case null: |
||||
return null; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} |
||||
|
||||
public static string SwitchOverString2() |
||||
{ |
||||
Console.WriteLine("SwitchOverString2:"); |
||||
switch (Environment.UserName) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
return "Text2"; |
||||
case "Third case": |
||||
return "Text3"; |
||||
case "Fourth case": |
||||
return "Text4"; |
||||
case "Fifth case": |
||||
return "Text5"; |
||||
case "Sixth case": |
||||
return "Text6"; |
||||
case "Seventh case": |
||||
return "Text7"; |
||||
case "Eighth case": |
||||
return "Text8"; |
||||
case "Ninth case": |
||||
return "Text9"; |
||||
case "Tenth case": |
||||
return "Text10"; |
||||
case "Eleventh case": |
||||
return "Text11"; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} |
||||
|
||||
public static string TwoDifferentSwitchBlocksInTryFinally() |
||||
{ |
||||
try { |
||||
Console.WriteLine("TwoDifferentSwitchBlocks:"); |
||||
switch (Environment.UserName) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
return "Text2"; |
||||
case "Third case": |
||||
return "Text3"; |
||||
case "Fourth case": |
||||
return "Text4"; |
||||
case "Fifth case": |
||||
return "Text5"; |
||||
case "Sixth case": |
||||
return "Text6"; |
||||
case "Seventh case": |
||||
return "Text7"; |
||||
case "Eighth case": |
||||
return "Text8"; |
||||
case "Ninth case": |
||||
return "Text9"; |
||||
case "Tenth case": |
||||
return "Text10"; |
||||
case "Eleventh case": |
||||
return "Text11"; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} finally { |
||||
Console.WriteLine("Second switch:"); |
||||
switch (Console.ReadLine()) { |
||||
case "12": |
||||
Console.WriteLine("Te43234xt1"); |
||||
break; |
||||
case "13": |
||||
Console.WriteLine("Te223443xt2"); |
||||
break; |
||||
case "14": |
||||
Console.WriteLine("Te234xt3"); |
||||
break; |
||||
case "15": |
||||
Console.WriteLine("Tex243t4"); |
||||
break; |
||||
case "16": |
||||
Console.WriteLine("Tex243t5"); |
||||
break; |
||||
case "17": |
||||
Console.WriteLine("Text2346"); |
||||
break; |
||||
case "18": |
||||
Console.WriteLine("Text234234"); |
||||
break; |
||||
case "19 case": |
||||
Console.WriteLine("Text8234"); |
||||
break; |
||||
case "20 case": |
||||
Console.WriteLine("Text923423"); |
||||
break; |
||||
case "21 case": |
||||
Console.WriteLine("Text10"); |
||||
break; |
||||
case "22 case": |
||||
Console.WriteLine("Text1134123"); |
||||
break; |
||||
default: |
||||
Console.WriteLine("Defa234234ult"); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static string SwitchOverBool(bool b) |
||||
{ |
||||
Console.WriteLine("SwitchOverBool: " + b.ToString()); |
||||
switch (b) { |
||||
case true: |
||||
return bool.TrueString; |
||||
case false: |
||||
return bool.FalseString; |
||||
default: |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public static void SwitchInLoop(int i) |
||||
{ |
||||
Console.WriteLine("SwitchInLoop: " + i); |
||||
while (true) { |
||||
switch (i) { |
||||
case 1: |
||||
Console.WriteLine("one"); |
||||
break; |
||||
case 2: |
||||
Console.WriteLine("two"); |
||||
break; |
||||
//case 3:
|
||||
// Console.WriteLine("three");
|
||||
// continue;
|
||||
case 4: |
||||
Console.WriteLine("four"); |
||||
return; |
||||
default: |
||||
Console.WriteLine("default"); |
||||
Console.WriteLine("more code"); |
||||
return; |
||||
} |
||||
i++; |
||||
} |
||||
} |
||||
|
||||
public static void SwitchWithGoto(int i) |
||||
{ |
||||
Console.WriteLine("SwitchWithGoto: " + i); |
||||
switch (i) { |
||||
case 1: |
||||
Console.WriteLine("one"); |
||||
goto default; |
||||
case 2: |
||||
Console.WriteLine("two"); |
||||
goto case 3; |
||||
case 3: |
||||
Console.WriteLine("three"); |
||||
break; |
||||
case 4: |
||||
Console.WriteLine("four"); |
||||
return; |
||||
default: |
||||
Console.WriteLine("default"); |
||||
break; |
||||
} |
||||
Console.WriteLine("End of method"); |
||||
} |
||||
|
||||
private static SetProperty[] GetProperties() |
||||
{ |
||||
return new SetProperty[0]; |
||||
} |
||||
|
||||
public static void SwitchOnStringInForLoop() |
||||
{ |
||||
ArrayList arrayList = new ArrayList(); |
||||
ArrayList arrayList2 = new ArrayList(); |
||||
SetProperty[] properties = GetProperties(); |
||||
for (int i = 0; i < properties.Length; i++) { |
||||
Console.WriteLine("In for-loop"); |
||||
SetProperty setProperty = properties[i]; |
||||
switch (setProperty.Property.Name) { |
||||
case "Name1": |
||||
setProperty.Set = 1; |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
case "Name2": |
||||
setProperty.Set = 2; |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
case "Name3": |
||||
setProperty.Set = 3; |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
case "Name4": |
||||
setProperty.Set = 4; |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
case "Name5": |
||||
case "Name6": |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
default: |
||||
arrayList2.Add(setProperty); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static void SwitchWithComplexCondition(string[] args) |
||||
{ |
||||
switch ((args.Length == 0) ? "dummy" : args[0]) { |
||||
case "a": |
||||
Console.WriteLine("a"); |
||||
break; |
||||
case "b": |
||||
Console.WriteLine("b"); |
||||
break; |
||||
case "c": |
||||
Console.WriteLine("c"); |
||||
break; |
||||
case "d": |
||||
Console.WriteLine("d"); |
||||
break; |
||||
} |
||||
Console.WriteLine("end"); |
||||
} |
||||
|
||||
public static void SwitchWithArray(string[] args) |
||||
{ |
||||
switch (args[0]) { |
||||
case "a": |
||||
Console.WriteLine("a"); |
||||
break; |
||||
case "b": |
||||
Console.WriteLine("b"); |
||||
break; |
||||
case "c": |
||||
Console.WriteLine("c"); |
||||
break; |
||||
case "d": |
||||
Console.WriteLine("d"); |
||||
break; |
||||
} |
||||
Console.WriteLine("end"); |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,412 @@
@@ -0,0 +1,412 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// 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; |
||||
using System.Reflection; |
||||
|
||||
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty |
||||
{ |
||||
public class Switch |
||||
{ |
||||
public class SetProperty |
||||
{ |
||||
public readonly PropertyInfo Property; |
||||
private int _set; |
||||
|
||||
public int Set { |
||||
get { |
||||
return _set; |
||||
} |
||||
|
||||
set { |
||||
_set = value; |
||||
} |
||||
} |
||||
|
||||
public SetProperty(PropertyInfo property) |
||||
{ |
||||
Property = property; |
||||
} |
||||
} |
||||
|
||||
public enum State |
||||
{ |
||||
False, |
||||
True, |
||||
Null |
||||
} |
||||
|
||||
public static string SparseIntegerSwitch(int i) |
||||
{ |
||||
Console.WriteLine("SparseIntegerSwitch: " + i); |
||||
switch (i) { |
||||
case -10000000: |
||||
return "-10 mln"; |
||||
case -100: |
||||
return "-hundred"; |
||||
case -1: |
||||
return "-1"; |
||||
case 0: |
||||
return "0"; |
||||
case 1: |
||||
return "1"; |
||||
case 2: |
||||
return "2"; |
||||
case 4: |
||||
return "4"; |
||||
case 100: |
||||
return "hundred"; |
||||
case 10000: |
||||
return "ten thousand"; |
||||
case 10001: |
||||
return "ten thousand and one"; |
||||
case int.MaxValue: |
||||
return "int.MaxValue"; |
||||
default: |
||||
return "something else"; |
||||
} |
||||
} |
||||
|
||||
public static void SwitchOverInt(int i) |
||||
{ |
||||
switch (i) { |
||||
case 0: |
||||
Console.WriteLine("zero"); |
||||
break; |
||||
case 5: |
||||
Console.WriteLine("five"); |
||||
break; |
||||
case 10: |
||||
Console.WriteLine("ten"); |
||||
break; |
||||
case 15: |
||||
Console.WriteLine("fifteen"); |
||||
break; |
||||
case 20: |
||||
Console.WriteLine("twenty"); |
||||
break; |
||||
case 25: |
||||
Console.WriteLine("twenty-five"); |
||||
break; |
||||
case 30: |
||||
Console.WriteLine("thirty"); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
public static string ShortSwitchOverString(string text) |
||||
{ |
||||
Console.WriteLine("ShortSwitchOverString: " + text); |
||||
switch (text) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
return "Text2"; |
||||
case "Third case": |
||||
return "Text3"; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} |
||||
|
||||
public static string ShortSwitchOverStringWithNullCase(string text) |
||||
{ |
||||
Console.WriteLine("ShortSwitchOverStringWithNullCase: " + text); |
||||
switch (text) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
return "Text2"; |
||||
case null: |
||||
return "null"; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} |
||||
|
||||
public static string SwitchOverString1(string text) |
||||
{ |
||||
Console.WriteLine("SwitchOverString1: " + text); |
||||
switch (text) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
case "2nd case": |
||||
return "Text2"; |
||||
case "Third case": |
||||
return "Text3"; |
||||
case "Fourth case": |
||||
return "Text4"; |
||||
case "Fifth case": |
||||
return "Text5"; |
||||
case "Sixth case": |
||||
return "Text6"; |
||||
case null: |
||||
return null; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} |
||||
|
||||
public static string SwitchOverString2() |
||||
{ |
||||
Console.WriteLine("SwitchOverString2:"); |
||||
switch (Environment.UserName) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
return "Text2"; |
||||
case "Third case": |
||||
return "Text3"; |
||||
case "Fourth case": |
||||
return "Text4"; |
||||
case "Fifth case": |
||||
return "Text5"; |
||||
case "Sixth case": |
||||
return "Text6"; |
||||
case "Seventh case": |
||||
return "Text7"; |
||||
case "Eighth case": |
||||
return "Text8"; |
||||
case "Ninth case": |
||||
return "Text9"; |
||||
case "Tenth case": |
||||
return "Text10"; |
||||
case "Eleventh case": |
||||
return "Text11"; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} |
||||
|
||||
public static string TwoDifferentSwitchBlocksInTryFinally() |
||||
{ |
||||
try { |
||||
Console.WriteLine("TwoDifferentSwitchBlocks:"); |
||||
switch (Environment.UserName) { |
||||
case "First case": |
||||
return "Text1"; |
||||
case "Second case": |
||||
return "Text2"; |
||||
case "Third case": |
||||
return "Text3"; |
||||
case "Fourth case": |
||||
return "Text4"; |
||||
case "Fifth case": |
||||
return "Text5"; |
||||
case "Sixth case": |
||||
return "Text6"; |
||||
case "Seventh case": |
||||
return "Text7"; |
||||
case "Eighth case": |
||||
return "Text8"; |
||||
case "Ninth case": |
||||
return "Text9"; |
||||
case "Tenth case": |
||||
return "Text10"; |
||||
case "Eleventh case": |
||||
return "Text11"; |
||||
default: |
||||
return "Default"; |
||||
} |
||||
} finally { |
||||
Console.WriteLine("Second switch:"); |
||||
switch (Console.ReadLine()) { |
||||
case "12": |
||||
Console.WriteLine("Te43234xt1"); |
||||
break; |
||||
case "13": |
||||
Console.WriteLine("Te223443xt2"); |
||||
break; |
||||
case "14": |
||||
Console.WriteLine("Te234xt3"); |
||||
break; |
||||
case "15": |
||||
Console.WriteLine("Tex243t4"); |
||||
break; |
||||
case "16": |
||||
Console.WriteLine("Tex243t5"); |
||||
break; |
||||
case "17": |
||||
Console.WriteLine("Text2346"); |
||||
break; |
||||
case "18": |
||||
Console.WriteLine("Text234234"); |
||||
break; |
||||
case "19 case": |
||||
Console.WriteLine("Text8234"); |
||||
break; |
||||
case "20 case": |
||||
Console.WriteLine("Text923423"); |
||||
break; |
||||
case "21 case": |
||||
Console.WriteLine("Text10"); |
||||
break; |
||||
case "22 case": |
||||
Console.WriteLine("Text1134123"); |
||||
break; |
||||
default: |
||||
Console.WriteLine("Defa234234ult"); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static string SwitchOverBool(bool b) |
||||
{ |
||||
Console.WriteLine("SwitchOverBool: " + b.ToString()); |
||||
switch (b) { |
||||
case true: |
||||
return bool.TrueString; |
||||
case false: |
||||
return bool.FalseString; |
||||
default: |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public static void SwitchInLoop(int i) |
||||
{ |
||||
Console.WriteLine("SwitchInLoop: " + i); |
||||
while (true) { |
||||
switch (i) { |
||||
case 1: |
||||
Console.WriteLine("one"); |
||||
break; |
||||
case 2: |
||||
Console.WriteLine("two"); |
||||
break; |
||||
//case 3:
|
||||
// Console.WriteLine("three");
|
||||
// continue;
|
||||
case 4: |
||||
Console.WriteLine("four"); |
||||
return; |
||||
default: |
||||
Console.WriteLine("default"); |
||||
Console.WriteLine("more code"); |
||||
return; |
||||
} |
||||
i++; |
||||
} |
||||
} |
||||
|
||||
public static void SwitchWithGoto(int i) |
||||
{ |
||||
Console.WriteLine("SwitchWithGoto: " + i); |
||||
switch (i) { |
||||
case 1: |
||||
Console.WriteLine("one"); |
||||
goto default; |
||||
case 2: |
||||
Console.WriteLine("two"); |
||||
goto case 3; |
||||
case 3: |
||||
Console.WriteLine("three"); |
||||
break; |
||||
case 4: |
||||
Console.WriteLine("four"); |
||||
return; |
||||
default: |
||||
Console.WriteLine("default"); |
||||
break; |
||||
} |
||||
Console.WriteLine("End of method"); |
||||
} |
||||
|
||||
private static SetProperty[] GetProperties() |
||||
{ |
||||
return new SetProperty[0]; |
||||
} |
||||
|
||||
public static void SwitchOnStringInForLoop() |
||||
{ |
||||
ArrayList arrayList = new ArrayList(); |
||||
ArrayList arrayList2 = new ArrayList(); |
||||
SetProperty[] properties = GetProperties(); |
||||
for (int i = 0; i < properties.Length; i++) { |
||||
Console.WriteLine("In for-loop"); |
||||
SetProperty setProperty = properties[i]; |
||||
switch (setProperty.Property.Name) { |
||||
case "Name1": |
||||
setProperty.Set = 1; |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
case "Name2": |
||||
setProperty.Set = 2; |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
case "Name3": |
||||
setProperty.Set = 3; |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
case "Name4": |
||||
setProperty.Set = 4; |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
case "Name5": |
||||
case "Name6": |
||||
arrayList.Add(setProperty); |
||||
break; |
||||
default: |
||||
arrayList2.Add(setProperty); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static void SwitchWithComplexCondition(string[] args) |
||||
{ |
||||
switch ((args.Length == 0) ? "dummy" : args[0]) { |
||||
case "a": |
||||
Console.WriteLine("a"); |
||||
break; |
||||
case "b": |
||||
Console.WriteLine("b"); |
||||
break; |
||||
case "c": |
||||
Console.WriteLine("c"); |
||||
break; |
||||
case "d": |
||||
Console.WriteLine("d"); |
||||
break; |
||||
} |
||||
Console.WriteLine("end"); |
||||
} |
||||
|
||||
public static void SwitchWithArray(string[] args) |
||||
{ |
||||
switch (args[0]) { |
||||
case "a": |
||||
Console.WriteLine("a"); |
||||
break; |
||||
case "b": |
||||
Console.WriteLine("b"); |
||||
break; |
||||
case "c": |
||||
Console.WriteLine("c"); |
||||
break; |
||||
case "d": |
||||
Console.WriteLine("d"); |
||||
break; |
||||
} |
||||
Console.WriteLine("end"); |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
using System; |
||||
|
||||
public sealed class EvType : MulticastDelegate |
||||
{ |
||||
|
||||
} |
||||
|
||||
[Serializable] |
||||
public class OwningClass |
||||
{ |
||||
public event EvType EvName; |
||||
} |
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
.class public auto ansi sealed EvType extends [mscorlib]System.MulticastDelegate |
||||
{ |
||||
// Methods not included. Just the run of the mill ctor + {Begin|End}?Invoke |
||||
} |
||||
|
||||
.class public auto ansi serializable beforefieldinit OwningClass |
||||
{ |
||||
|
||||
.field class EvType EvName |
||||
|
||||
.event EvType EvName |
||||
{ |
||||
.addon instance void OwningClass::add_EvName(class EvType) |
||||
.removeon instance void OwningClass::remove_EvName(class EvType) |
||||
} |
||||
|
||||
.method public hidebysig specialname |
||||
instance void add_EvName ( |
||||
class EvType 'value' |
||||
) cil managed |
||||
{ |
||||
.maxstack 3 |
||||
.locals init ( |
||||
[0] class EvType, |
||||
[1] class EvType |
||||
) |
||||
|
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldfld class EvType OwningClass::EvName |
||||
IL_0006: stloc.0 |
||||
// loop start (head: IL_0007) |
||||
IL_0007: ldloc.0 |
||||
IL_0008: stloc.1 |
||||
IL_0009: ldarg.0 |
||||
IL_000a: ldflda class EvType OwningClass::EvName |
||||
IL_000f: ldloc.1 |
||||
IL_0010: ldarg.1 |
||||
IL_0011: call class [mscorlib]System.Delegate [mscorlib]System.Delegate::Combine(class [mscorlib]System.Delegate, class [mscorlib]System.Delegate) |
||||
IL_0016: castclass EvType |
||||
IL_001b: ldloc.0 |
||||
IL_001c: call !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class EvType>(!!0&, !!0, !!0) |
||||
IL_0021: stloc.0 |
||||
IL_0022: ldloc.0 |
||||
IL_0023: ldloc.1 |
||||
IL_0024: bne.un IL_0007 |
||||
// end loop |
||||
IL_0029: ret |
||||
} // end of method OwningClass::add_EvName |
||||
|
||||
.method public hidebysig specialname |
||||
instance void remove_EvName ( |
||||
class EvType 'value' |
||||
) cil managed |
||||
{ |
||||
.maxstack 3 |
||||
.locals init ( |
||||
[0] class EvType, |
||||
[1] class EvType |
||||
) |
||||
|
||||
IL_0000: ldarg.0 |
||||
IL_0001: ldfld class EvType OwningClass::EvName |
||||
IL_0006: stloc.0 |
||||
// loop start (head: IL_0007) |
||||
IL_0007: ldloc.0 |
||||
IL_0008: stloc.1 |
||||
IL_0009: ldarg.0 |
||||
IL_000a: ldflda class EvType OwningClass::EvName |
||||
IL_000f: ldloc.1 |
||||
IL_0010: ldarg.1 |
||||
IL_0011: call class [mscorlib]System.Delegate [mscorlib]System.Delegate::Remove(class [mscorlib]System.Delegate, class [mscorlib]System.Delegate) |
||||
IL_0016: castclass EvType |
||||
IL_001b: ldloc.0 |
||||
IL_001c: call !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class EvType>(!!0&, !!0, !!0) |
||||
IL_0021: stloc.0 |
||||
IL_0022: ldloc.0 |
||||
IL_0023: ldloc.1 |
||||
IL_0024: bne.un IL_0007 |
||||
// end loop |
||||
IL_0029: ret |
||||
} // end of method OwningClass::remove_EvName |
||||
|
||||
} // end of class OwningClass |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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,21 @@
@@ -0,0 +1,21 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Threading.Tasks; |
||||
using ICSharpCode.Decompiler.TypeSystem; |
||||
using ICSharpCode.Decompiler.TypeSystem.Implementation; |
||||
|
||||
namespace ICSharpCode.Decompiler.Tests.TypeSystem |
||||
{ |
||||
public static class TypeSystemHelper |
||||
{ |
||||
public static ICompilation CreateCompilation(params IUnresolvedTypeDefinition[] unresolvedTypeDefinitions) |
||||
{ |
||||
var unresolvedAsm = new DefaultUnresolvedAssembly("dummy"); |
||||
foreach (var typeDef in unresolvedTypeDefinitions) |
||||
unresolvedAsm.AddTypeDefinition(typeDef); |
||||
return new SimpleCompilation(unresolvedAsm, TypeSystemLoaderTests.Mscorlib, TypeSystemLoaderTests.SystemCore); |
||||
} |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue