Browse Source

Remove pre-.NET 4.5 ifdefs

pull/832/head
Daniel Grunwald 8 years ago
parent
commit
2c762ee686
  1. 5
      ICSharpCode.Decompiler/CSharp/Syntax/AstNodeCollection.cs
  2. 51
      ICSharpCode.Decompiler/Tests/TestCases/Correctness/InitializerTests.cs
  3. 4
      ICSharpCode.Decompiler/Tests/TestCases/Pretty/Async.cs
  4. 5
      ICSharpCode.Decompiler/Util/EmptyList.cs
  5. 6
      ICSharpCode.Decompiler/Util/LazyInit.cs
  6. 7
      ICSharpCode.Decompiler/Util/MultiDictionary.cs
  7. 2
      README.txt
  8. 2
      clean.bat
  9. 2
      debugbuild.bat
  10. 2
      releasebuild.bat

5
ICSharpCode.Decompiler/CSharp/Syntax/AstNodeCollection.cs

@ -28,10 +28,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -28,10 +28,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// <summary>
/// Represents the children of an AstNode that have a specific role.
/// </summary>
public class AstNodeCollection<T> : ICollection<T>
#if NET_4_5
, IReadOnlyCollection<T>
#endif
public class AstNodeCollection<T> : ICollection<T>, IReadOnlyCollection<T>
where T : AstNode
{
readonly AstNode node;

51
ICSharpCode.Decompiler/Tests/TestCases/Correctness/InitializerTests.cs

@ -76,6 +76,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -76,6 +76,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
get;
set;
}
public InitializerTests.Data this[int i]
{
get {
return null;
}
set { }
}
}
private struct StructData
@ -514,11 +522,36 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -514,11 +522,36 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data
{
MoreData =
{
a = InitializerTests.MyEnum.a
}
{
a = InitializerTests.MyEnum.a,
MoreData = {
a = InitializerTests.MyEnum.b
}
}
});
}
#if false
static int GetInt()
{
return 1;
}
public static void MixedObjectAndDictInitializer()
{
InitializerTests.X(InitializerTests.Y(), new InitializerTests.Data {
MoreData =
{
a = InitializerTests.MyEnum.a,
[GetInt()] = {
a = InitializerTests.MyEnum.b,
FieldList = { MyEnum2.c },
[2] = null
},
}
});
}
#endif
public static void ObjectInitializerWithInitializationOfDeeplyNestedObjects()
{
@ -582,14 +615,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -582,14 +615,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
InitializerTests.X(InitializerTests.Y(), new InitializerTests.StructData
{
MoreData =
{
a = InitializerTests.MyEnum.a,
FieldList =
{
InitializerTests.MyEnum2.c,
InitializerTests.MyEnum2.d
a = InitializerTests.MyEnum.a,
FieldList =
{
InitializerTests.MyEnum2.c,
InitializerTests.MyEnum2.d
}
}
}
});
}

4
ICSharpCode.Decompiler/Tests/TestCases/Pretty/Async.cs

@ -127,6 +127,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -127,6 +127,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
#if !LEGACY_CSC
public async Task AwaitCatch(Task<int> task)
{
try {
@ -146,6 +147,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -146,6 +147,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
Console.WriteLine(await task);
}
}
#endif
public async Task<int> NestedAwait(Task<Task<int>> task)
{
@ -167,6 +169,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -167,6 +169,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
#if !LEGACY_CSC
public async Task AwaitInCatch(Task<int> task1, Task<int> task2)
{
try {
@ -194,5 +197,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -194,5 +197,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
Console.WriteLine("End Method");
}
#endif
}
}

5
ICSharpCode.Decompiler/Util/EmptyList.cs

@ -23,10 +23,7 @@ using System.Collections.Generic; @@ -23,10 +23,7 @@ using System.Collections.Generic;
namespace ICSharpCode.Decompiler.Util
{
[Serializable]
public sealed class EmptyList<T> : IList<T>, IEnumerator<T>
#if NET_4_5
, IReadOnlyList<T>
#endif
public sealed class EmptyList<T> : IList<T>, IEnumerator<T>, IReadOnlyList<T>
{
public static readonly EmptyList<T> Instance = new EmptyList<T>();

6
ICSharpCode.Decompiler/Util/LazyInit.cs

@ -24,13 +24,7 @@ namespace ICSharpCode.Decompiler.Util @@ -24,13 +24,7 @@ namespace ICSharpCode.Decompiler.Util
{
public static T VolatileRead<T>(ref T location) where T : class
{
#if NET_4_5
return Volatile.Read(ref location);
#else
T result = location;
Thread.MemoryBarrier();
return result;
#endif
}
/// <summary>

7
ICSharpCode.Decompiler/Util/MultiDictionary.cs

@ -75,14 +75,9 @@ namespace ICSharpCode.Decompiler.Util @@ -75,14 +75,9 @@ namespace ICSharpCode.Decompiler.Util
dict.Clear();
}
#if NET_4_5
public IReadOnlyList<TValue> this[TKey key] {
#else
public IList<TValue> this[TKey key] {
#endif
get {
List<TValue> list;
if (dict.TryGetValue(key, out list))
if (dict.TryGetValue(key, out var list))
return list;
else
return EmptyList<TValue>.Instance;

2
README.txt

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
ILSpy is the open-source .NET assembly browser and decompiler.
Website: http://www.ilspy.net/
Copyright 2011-2016 AlphaSierraPapa for the SharpDevelop team
Copyright 2011-2017 AlphaSierraPapa for the SharpDevelop team
License: ILSpy is distributed under the MIT License.
Included open-source libraries:

2
clean.bat

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
@if not exist "NRefactory\NRefactory.sln" (
@if not exist "cecil\Mono.Cecil.csproj" (
git submodule update --init || exit /b 1
)
@setlocal enabledelayedexpansion

2
debugbuild.bat

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
@if not exist "NRefactory\NRefactory.sln" (
@if not exist "cecil\Mono.Cecil.csproj" (
git submodule update --init || exit /b 1
)
@setlocal enabledelayedexpansion

2
releasebuild.bat

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
@if not exist "NRefactory\NRefactory.sln" (
@if not exist "cecil\Mono.Cecil.csproj" (
git submodule update --init || exit /b 1
)
@setlocal enabledelayedexpansion

Loading…
Cancel
Save