diff options
author | jfrijters <jfrijters> | 2011-12-01 10:30:50 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2011-12-01 10:30:50 +0400 |
commit | 3c49c20346609d4c397dff93d25bb68297301516 (patch) | |
tree | 926cbcef8a32139fb0cbaa3ad15e9690351a1379 /reflect/Reader | |
parent | ed23e4ca4ec0e5fc797e47e7dea004941e02e853 (diff) |
- Rewrote custom modifier handling to retain ordering.
- Added ConstructorInfo.__ReturnParameter to expose custom modifiers.
- Added __GetCustomModifiers() to various *Info types.
- Added CustomModifiers type to encapsulate a custom modifier sequence.
- Added CustomModifiersBuilder to create a CustomModifiers sequence.
- Marked a number of IKVM.Reflection specific methods Obsolete, because they are replaced with method that take CustomModifiers value(s).
Diffstat (limited to 'reflect/Reader')
-rw-r--r-- | reflect/Reader/Method.cs | 13 | ||||
-rw-r--r-- | reflect/Reader/TypeDefImpl.cs | 10 |
2 files changed, 7 insertions, 16 deletions
diff --git a/reflect/Reader/Method.cs b/reflect/Reader/Method.cs index 853b3548..1b9473db 100644 --- a/reflect/Reader/Method.cs +++ b/reflect/Reader/Method.cs @@ -351,7 +351,7 @@ namespace IKVM.Reflection.Reader private static void AddNamedArgument(List<CustomAttributeNamedArgument> list, Type attributeType, string fieldName, Type valueType, object value) { // some fields are not available on the .NET Compact Framework version of DllImportAttribute - FieldInfo field = attributeType.FindField(fieldName, FieldSignature.Create(valueType, null, null)); + FieldInfo field = attributeType.FindField(fieldName, FieldSignature.Create(valueType, new CustomModifiers())); if (field != null) { list.Add(new CustomAttributeNamedArgument(field, new CustomAttributeTypedArgument(valueType, value))); @@ -449,14 +449,11 @@ namespace IKVM.Reflection.Reader } } - public override Type[] GetRequiredCustomModifiers() + public override CustomModifiers __GetCustomModifiers() { - return Util.Copy(position == -1 ? method.MethodSignature.GetReturnTypeRequiredCustomModifiers(method) : method.MethodSignature.GetParameterRequiredCustomModifiers(method, position)); - } - - public override Type[] GetOptionalCustomModifiers() - { - return Util.Copy(position == -1 ? method.MethodSignature.GetReturnTypeOptionalCustomModifiers(method) : method.MethodSignature.GetParameterOptionalCustomModifiers(method, position)); + return position == -1 + ? method.MethodSignature.GetReturnTypeCustomModifiers(method) + : method.MethodSignature.GetParameterCustomModifiers(method, position); } public override MemberInfo Member diff --git a/reflect/Reader/TypeDefImpl.cs b/reflect/Reader/TypeDefImpl.cs index bd011923..fbfb2eb4 100644 --- a/reflect/Reader/TypeDefImpl.cs +++ b/reflect/Reader/TypeDefImpl.cs @@ -297,16 +297,10 @@ namespace IKVM.Reflection.Reader return typeArgs[index]; } - public override Type[][] __GetGenericArgumentsOptionalCustomModifiers() + public override CustomModifiers[] __GetGenericArgumentsCustomModifiers() { PopulateGenericArguments(); - return Util.Copy(new Type[typeArgs.Length][]); - } - - public override Type[][] __GetGenericArgumentsRequiredCustomModifiers() - { - PopulateGenericArguments(); - return Util.Copy(new Type[typeArgs.Length][]); + return new CustomModifiers[typeArgs.Length]; } public override bool IsGenericType |