Imported Upstream version 4.2.0.179

Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent aa7da660d6
commit c042cd0c52
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -37,6 +37,7 @@ using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Text;
using System.Diagnostics.Contracts;
namespace System.Reflection {
@@ -73,9 +74,87 @@ namespace System.Reflection {
internal delegate object GetterAdapter (object _this);
internal delegate R Getter<T,R> (T _this);
abstract class RuntimePropertyInfo : PropertyInfo, ISerializable
{
internal BindingFlags BindingFlags {
get {
return 0;
}
}
public override Module Module {
get {
return GetRuntimeModule ();
}
}
internal RuntimeType GetDeclaringTypeInternal ()
{
return (RuntimeType) DeclaringType;
}
RuntimeType ReflectedTypeInternal {
get {
return (RuntimeType) ReflectedType;
}
}
internal RuntimeModule GetRuntimeModule ()
{
return GetDeclaringTypeInternal ().GetRuntimeModule ();
}
#region Object Overrides
public override String ToString()
{
return FormatNameAndSig(false);
}
private string FormatNameAndSig(bool serialization)
{
StringBuilder sbName = new StringBuilder(PropertyType.FormatTypeName(serialization));
sbName.Append(" ");
sbName.Append(Name);
var pi = GetIndexParameters ();
if (pi.Length > 0) {
sbName.Append (" [");
ParameterInfo.FormatParameters (sbName, pi, 0, serialization);
sbName.Append ("]");
}
return sbName.ToString();
}
#endregion
#region ISerializable Implementation
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException("info");
Contract.EndContractBlock();
MemberInfoSerializationHolder.GetSerializationInfo(
info,
Name,
ReflectedTypeInternal,
ToString(),
SerializationToString(),
MemberTypes.Property,
null);
}
internal string SerializationToString()
{
return FormatNameAndSig(true);
}
#endregion
}
[Serializable]
[StructLayout (LayoutKind.Sequential)]
internal class MonoProperty : PropertyInfo, ISerializable {
internal class MonoProperty : RuntimePropertyInfo {
#pragma warning disable 649
internal IntPtr klass;
internal IntPtr prop;
@@ -366,29 +445,6 @@ namespace System.Reflection {
method.Invoke (obj, invokeAttr, binder, parms, culture);
}
public override string ToString ()
{
var sb = new StringBuilder ();
Type retType = PropertyType;
if (Type.ShouldPrintFullName (retType))
sb.Append (retType.ToString ());
else
sb.Append (retType.Name);
sb.Append (" ");
sb.Append (Name);
var pi = GetIndexParameters ();
if (pi.Length > 0) {
sb.Append (" [");
ParameterInfo.FormatParameters (sb, pi);
sb.Append ("]");
}
return sb.ToString ();
}
public override Type[] GetOptionalCustomModifiers () {
Type[] types = MonoPropertyInfo.GetTypeModifiers (this, true);
if (types == null)
@@ -403,13 +459,6 @@ namespace System.Reflection {
return types;
}
// ISerializable
public void GetObjectData (SerializationInfo info, StreamingContext context)
{
MemberInfoSerializationHolder.Serialize (info, Name, ReflectedType,
ToString(), MemberTypes.Property);
}
public override IList<CustomAttributeData> GetCustomAttributesData () {
return CustomAttributeData.GetCustomAttributes (this);
}