Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -1,38 +0,0 @@
//
// Actions.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2011 Jb Evain
//
// 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.
//
#if !NET_3_5 && !NET_4_0
namespace Mono {
//delegate void Action ();
delegate void Action<T1, T2> (T1 arg1, T2 arg2);
//delegate void Action<T1, T2, T3> (T1 arg1, T2 arg2, T3 arg3);
//delegate void Action<T1, T2, T3, T4> (T1 arg1, T2 arg2, T3 arg3, T4 arg4);
}
#endif

45
external/cecil/Mono/Disposable.cs vendored Normal file
View File

@@ -0,0 +1,45 @@
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2015 Jb Evain
// Copyright (c) 2008 - 2011 Novell, Inc.
//
// Licensed under the MIT/X11 license.
//
using System;
namespace Mono {
static class Disposable {
public static Disposable<T> Owned<T> (T value) where T : class, IDisposable
{
return new Disposable<T> (value, owned: true);
}
public static Disposable<T> NotOwned<T> (T value) where T : class, IDisposable
{
return new Disposable<T> (value, owned: false);
}
}
struct Disposable<T> : IDisposable where T : class, IDisposable {
internal readonly T value;
readonly bool owned;
public Disposable (T value, bool owned)
{
this.value = value;
this.owned = owned;
}
public void Dispose ()
{
if (value != null && owned)
value.Dispose ();
}
}
}

View File

@@ -1,29 +1,11 @@
//
// Empty.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2011 Jb Evain
// Copyright (c) 2008 - 2015 Jb Evain
// Copyright (c) 2008 - 2011 Novell, Inc.
//
// 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.
// Licensed under the MIT/X11 license.
//
using System;
@@ -53,14 +35,19 @@ namespace Mono.Cecil {
public static T [] Resize<T> (this T [] self, int length)
{
#if !CF
Array.Resize (ref self, length);
#else
var copy = new T [length];
Array.Copy (self, copy, self.Length);
self = copy;
#endif
return self;
}
public static T [] Add<T> (this T [] self, T item)
{
if (self == null) {
self = new [] { item };
return self;
}
self = self.Resize (self.Length + 1);
self [self.Length - 1] = item;
return self;
}
}

View File

@@ -1,39 +0,0 @@
//
// Funcs.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2011 Jb Evain
//
// 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.
//
#if !NET_3_5 && !NET_4_0
namespace Mono {
delegate TResult Func<TResult> ();
delegate TResult Func<T, TResult> (T arg1);
delegate TResult Func<T1, T2, TResult> (T1 arg1, T2 arg2);
//delegate TResult Func<T1, T2, T3, TResult> (T1 arg1, T2 arg2, T3 arg3);
//delegate TResult Func<T1, T2, T3, T4, TResult> (T1 arg1, T2 arg2, T3 arg3, T4 arg4);
}
#endif

91
external/cecil/Mono/Type.cs vendored Normal file
View File

@@ -0,0 +1,91 @@
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2015 Jb Evain
// Copyright (c) 2008 - 2011 Novell, Inc.
//
// Licensed under the MIT/X11 license.
//
using System;
using System.Reflection;
#if NET_CORE
using System.Collections.Generic;
#endif
namespace Mono {
#if NET_CORE
enum TypeCode {
Empty = 0,
Object = 1,
DBNull = 2,
Boolean = 3,
Char = 4,
SByte = 5,
Byte = 6,
Int16 = 7,
UInt16 = 8,
Int32 = 9,
UInt32 = 10,
Int64 = 11,
UInt64 = 12,
Single = 13,
Double = 14,
Decimal = 15,
DateTime = 16,
String = 18
}
#endif
static class TypeExtensions {
#if NET_CORE
private static readonly Dictionary<Type, TypeCode> TypeCodeMap = new Dictionary<Type, TypeCode>
{
{ typeof (bool), TypeCode.Boolean },
{ typeof (char), TypeCode.Char },
{ typeof (sbyte), TypeCode.SByte },
{ typeof (byte), TypeCode.Byte },
{ typeof (short), TypeCode.Int16 },
{ typeof (ushort), TypeCode.UInt16 },
{ typeof (int), TypeCode.Int32 },
{ typeof (uint), TypeCode.UInt32 },
{ typeof (long), TypeCode.Int64 },
{ typeof (ulong), TypeCode.UInt64 },
{ typeof (float), TypeCode.Single },
{ typeof (double), TypeCode.Double },
{ typeof (decimal), TypeCode.Decimal },
{ typeof (DateTime), TypeCode.DateTime },
{ typeof (string), TypeCode.String },
};
#endif
public static TypeCode GetTypeCode (this Type type)
{
#if NET_CORE
if (type == null)
return TypeCode.Empty;
TypeCode code;
if (!TypeCodeMap.TryGetValue (type, out code))
return TypeCode.Object;
return code;
#else
return Type.GetTypeCode (type);
#endif
}
public static Assembly GetAssembly (this Type type)
{
#if NET_CORE
return type.GetTypeInfo ().Assembly;
#else
return type.Assembly;
#endif
}
}
}