diff options
author | jfrijters <jfrijters> | 2011-12-01 12:30:54 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2011-12-01 12:30:54 +0400 |
commit | a1709bdbc80521975c606b1f73cd7cf619b6ec63 (patch) | |
tree | 5c503d0730764d9895b669deef8a2bab4837bdee /reflect/StandAloneMethodSig.cs | |
parent | b1d03c25d3dc212e64e855214d1ebe98b5b1259c (diff) |
Added support for custom modifiers to StandAloneMethodSig.
Diffstat (limited to 'reflect/StandAloneMethodSig.cs')
-rw-r--r-- | reflect/StandAloneMethodSig.cs | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/reflect/StandAloneMethodSig.cs b/reflect/StandAloneMethodSig.cs index 74d58d15..1371bf6f 100644 --- a/reflect/StandAloneMethodSig.cs +++ b/reflect/StandAloneMethodSig.cs @@ -35,8 +35,9 @@ namespace IKVM.Reflection private readonly Type returnType; private readonly Type[] parameterTypes; private readonly Type[] optionalParameterTypes; + private readonly PackedCustomModifiers customModifiers; - internal __StandAloneMethodSig(bool unmanaged, CallingConvention unmanagedCallingConvention, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes) + internal __StandAloneMethodSig(bool unmanaged, CallingConvention unmanagedCallingConvention, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes, PackedCustomModifiers customModifiers) { this.unmanaged = unmanaged; this.unmanagedCallingConvention = unmanagedCallingConvention; @@ -44,6 +45,7 @@ namespace IKVM.Reflection this.returnType = returnType; this.parameterTypes = parameterTypes; this.optionalParameterTypes = optionalParameterTypes; + this.customModifiers = customModifiers; } public bool Equals(__StandAloneMethodSig other) @@ -54,7 +56,8 @@ namespace IKVM.Reflection && other.callingConvention == callingConvention && other.returnType == returnType && Util.ArrayEquals(other.parameterTypes, parameterTypes) - && Util.ArrayEquals(other.optionalParameterTypes, optionalParameterTypes); + && Util.ArrayEquals(other.optionalParameterTypes, optionalParameterTypes) + && other.customModifiers.Equals(customModifiers); } public override bool Equals(object obj) @@ -88,6 +91,11 @@ namespace IKVM.Reflection get { return returnType; } } + public CustomModifiers GetReturnTypeCustomModifiers() + { + return customModifiers.GetReturnTypeCustomModifiers(); + } + public Type[] ParameterTypes { get { return Util.Copy(parameterTypes); } @@ -97,5 +105,27 @@ namespace IKVM.Reflection { get { return Util.Copy(optionalParameterTypes); } } + + public CustomModifiers GetParameterCustomModifiers(int index) + { + return customModifiers.GetParameterCustomModifiers(index); + } + + internal int ParameterCount + { + get { return parameterTypes.Length + optionalParameterTypes.Length; } + } + + public static __StandAloneMethodSig Create(CallingConvention callingConvention, Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers) + { + return new __StandAloneMethodSig(true, callingConvention, 0, returnType, Util.Copy(parameterTypes), Type.EmptyTypes, + PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes))); + } + + public static __StandAloneMethodSig Create(CallingConventions callingConvention, Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, Type[] optionalParameterTypes, CustomModifiers[] parameterTypeCustomModifiers) + { + return new __StandAloneMethodSig(false, 0, callingConvention, returnType, Util.Copy(parameterTypes), Util.Copy(optionalParameterTypes), + PackedCustomModifiers.CreateFromExternal(returnTypeCustomModifiers, parameterTypeCustomModifiers, Util.NullSafeLength(parameterTypes) + Util.NullSafeLength(optionalParameterTypes))); + } } } |