Imported Upstream version 5.18.0.142

Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-09 08:20:59 +00:00
parent e52655b4dc
commit 0abdbe5a7d
1547 changed files with 93792 additions and 47893 deletions

View File

@ -27,6 +27,7 @@
// 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.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.CompilerServices;
@ -222,6 +223,46 @@ namespace System.Reflection {
return attrs;
}
internal CustomAttributeData[] GetPseudoCustomAttributesData ()
{
int count = 0;
if (IsNotSerialized)
count++;
if (DeclaringType.IsExplicitLayout)
count++;
MarshalAsAttribute marshalAs = get_marshal_info ();
if (marshalAs != null)
count++;
if (count == 0)
return null;
CustomAttributeData[] attrsData = new CustomAttributeData [count];
count = 0;
if (IsNotSerialized)
attrsData [count++] = new CustomAttributeData ((typeof (NonSerializedAttribute)).GetConstructor (Type.EmptyTypes));
if (DeclaringType.IsExplicitLayout) {
var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (int), GetFieldOffset ()) };
attrsData [count++] = new CustomAttributeData (
(typeof (FieldOffsetAttribute)).GetConstructor (new[] { typeof (int) }),
ctorArgs,
EmptyArray<CustomAttributeNamedArgument>.Value);
}
if (marshalAs != null) {
var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (UnmanagedType), marshalAs.Value) };
attrsData [count++] = new CustomAttributeData (
(typeof (MarshalAsAttribute)).GetConstructor (new[] { typeof (UnmanagedType) }),
ctorArgs,
EmptyArray<CustomAttributeNamedArgument>.Value);//FIXME Get named params
}
return attrsData;
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern Type[] GetTypeModifiers (bool optional);