diff options
author | jfrijters <jfrijters> | 2011-03-16 11:05:09 +0300 |
---|---|---|
committer | jfrijters <jfrijters> | 2011-03-16 11:05:09 +0300 |
commit | 944c74fd91cacc7aa77d0b477091dc4924e58b09 (patch) | |
tree | 1b445e6eceee74a399409515504f5c1cbd430fbf /reflect/Type.cs | |
parent | f8a15b92018d0f0e7af2386f34321bab95fa3d3d (diff) |
Added API extension for creating missing methods and fields.
Diffstat (limited to 'reflect/Type.cs')
-rw-r--r-- | reflect/Type.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/reflect/Type.cs b/reflect/Type.cs index 0ef3990a..6fb2e2e1 100644 --- a/reflect/Type.cs +++ b/reflect/Type.cs @@ -1657,6 +1657,27 @@ namespace IKVM.Reflection u.GetMissingMethodOrThrow(this, ".ctor", methodSig); return (ConstructorInfo)mb; } + + public MethodBase __CreateMissingMethod(string name, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers) + { + MethodSignature sig = new MethodSignature( + returnType ?? this.Module.universe.System_Void, + Util.Copy(parameterTypes), + PackedCustomModifiers.CreateFromExternal(returnTypeOptionalCustomModifiers, returnTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, parameterTypeRequiredCustomModifiers, parameterTypes.Length), + callingConvention, + 0); + MethodInfo method = new MissingMethod(this, name, sig); + if (name == ".ctor" || name == ".cctor") + { + return new ConstructorInfoImpl(method); + } + return method; + } + + public FieldInfo __CreateMissingField(string name, Type fieldType, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers) + { + return new MissingField(this, name, FieldSignature.Create(fieldType, optionalCustomModifiers, requiredCustomModifiers)); + } } abstract class ElementHolderType : Type |