Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@@ -90,12 +90,42 @@ namespace System.Reflection {
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal static extern object get_default_value (RuntimePropertyInfo prop);
#if NETCORE
internal BindingFlags BindingFlags {
get {
return 0;
CachePropertyInfo (PInfo.GetMethod | PInfo.SetMethod);
bool isPublic = info.set_method?.IsPublic == true || info.get_method?.IsPublic == true;
bool isStatic = info.set_method?.IsStatic == true || info.get_method?.IsStatic == true;
bool isInherited = DeclaringType != ReflectedType;
return FilterPreCalculate (isPublic, isInherited, isStatic);
}
}
// Copied from https://github.com/dotnet/coreclr/blob/7a24a538cd265993e5864179f51781398c28ecdf/src/System.Private.CoreLib/src/System/RtType.cs#L2022
static BindingFlags FilterPreCalculate (bool isPublic, bool isInherited, bool isStatic)
{
BindingFlags bindingFlags = isPublic ? BindingFlags.Public : BindingFlags.NonPublic;
if (isInherited) {
// We arrange things so the DeclaredOnly flag means "include inherited members"
bindingFlags |= BindingFlags.DeclaredOnly;
if (isStatic)
bindingFlags |= BindingFlags.Static | BindingFlags.FlattenHierarchy;
else
bindingFlags |= BindingFlags.Instance;
}
else {
if (isStatic)
bindingFlags |= BindingFlags.Static;
else
bindingFlags |= BindingFlags.Instance;
}
return bindingFlags;
}
#else
internal BindingFlags BindingFlags => 0;
#endif
public override Module Module {
get {
return GetRuntimeModule ();
@@ -126,9 +156,6 @@ namespace System.Reflection {
private string FormatNameAndSig(bool serialization)
{
#if NETCORE
throw new NotImplementedException ();
#else
StringBuilder sbName = new StringBuilder(PropertyType.FormatTypeName(serialization));
sbName.Append(" ");
@@ -142,7 +169,6 @@ namespace System.Reflection {
}
return sbName.ToString();
#endif
}
#endregion
@@ -381,7 +407,7 @@ namespace System.Reflection {
MethodInfo method = GetGetMethod (true);
if (method == null)
throw new ArgumentException ($"Get Method not found for '{Name}'");
if (!DeclaringType.IsValueType && !method.ContainsGenericParameters) { //FIXME find a way to build an invoke delegate for value types.
if (!DeclaringType.IsValueType && !PropertyType.IsByRef && !method.ContainsGenericParameters) { //FIXME find a way to build an invoke delegate for value types.
cached_getter = CreateGetterDelegate (method);
// The try-catch preserves the .Invoke () behaviour
try {
@@ -453,9 +479,7 @@ namespace System.Reflection {
return CustomAttributeData.GetCustomAttributes (this);
}
#if !NETCORE
public sealed override bool HasSameMetadataDefinitionAs (MemberInfo other) => HasSameMetadataDefinitionAsCore<RuntimePropertyInfo> (other);
#endif
public override int MetadataToken {
get {