+2008-07-16 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * MethodOnTypeBuilderInst.cs: Special case all methods
+ under compiler context as needed by mcs.
+
+ * MethodBuilder.cs: Change the visibility of some fields
+ to internal so MethodOnTypeBuilderInst can use it.
+
2008-07-11 Marek Safar <marek.safar@gmail.com>
* ModuleBuilder.cs: Couple of micro optimizations.
{
private RuntimeMethodHandle mhandle;
private Type rtype;
- private Type[] parameters;
+ internal Type[] parameters;
private MethodAttributes attrs; /* It's used directly by MCS */
private MethodImplAttributes iattrs;
private string name;
private byte[] code;
private ILGenerator ilgen;
private TypeBuilder type;
- private ParameterBuilder[] pinfo;
+ internal ParameterBuilder[] pinfo;
private CustomAttributeBuilder[] cattrs;
private MethodInfo override_method;
private string pi_dll;
}
public override Type ReturnType {
- get { return mb.ReturnType; }
+ get {
+ if (!((ModuleBuilder)mb.Module).assemblyb.IsCompilerContext)
+ return mb.ReturnType;
+ return instantiation.InflateType (mb.ReturnType);
+ }
}
public override bool IsDefined (Type attributeType, bool inherit)
public override ParameterInfo [] GetParameters ()
{
- throw new NotSupportedException ();
+ if (!((ModuleBuilder)mb.Module).assemblyb.IsCompilerContext)
+ throw new NotSupportedException ();
+
+ ParameterInfo [] res = new ParameterInfo [mb.parameters.Length];
+ for (int i = 0; i < mb.parameters.Length; i++) {
+ Type type = instantiation.InflateType (mb.parameters [i]);
+ res [i] = new ParameterInfo (mb.pinfo == null ? null : mb.pinfo [i + 1], type, this, i + 1);
+ }
+ return res;
+ }
+
+ public override int MetadataToken {
+ get {
+ if (!((ModuleBuilder)mb.Module).assemblyb.IsCompilerContext)
+ return base.MetadataToken;
+ return mb.MetadataToken;
+ }
}
internal override int GetParameterCount ()
public override Type [] GetGenericArguments ()
{
+ //FIXME test that once we support generic methods
return mb.GetGenericArguments ();
}
public override bool IsGenericMethodDefinition {
get {
+ //FIXME test that once we support generic methods
return mb.IsGenericMethodDefinition;
}
}
public override bool IsGenericMethod {
get {
+ //FIXME test that once we support generic methods
return mb.IsGenericMethod;
}
}
+2008-07-16 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * MonoGenericClass.cs (GetMethod): Use the new codepath for compiler
+ context.
+
+ * MonoGenericClass.cs: New InflateType method, used to inflate
+ managed types.
+
2008-07-11 Marek Safar <marek.safar@gmail.com>
* MonoGenericClass.cs (GetField): Put back removed code.
-2008-07-04 Rodrigo Kumpera <rkumpera@n ovell.com>
+2008-07-04 Rodrigo Kumpera <rkumpera@novell.com>
* MethodBase.cs (GetMethodFromHandle): Fix a warning in
the 1.0 build.
[MethodImplAttribute(MethodImplOptions.InternalCall)]
protected extern Type GetParentType ();
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern Type InflateType_internal (Type type);
+
+ internal Type InflateType (Type type)
+ {
+ if (!type.IsGenericParameter && !type.ContainsGenericParameters)
+ return type;
+ return InflateType_internal (type);
+ }
+
[MethodImplAttribute(MethodImplOptions.InternalCall)]
protected extern MonoGenericClass[] GetInterfaces_internal ();
// MethodOnTypeBuilderInst objects
// Also, mono_image_get_method_on_inst_token () can't handle generic
// methods
- if (!((ModuleBuilder)mb.Module).assemblyb.IsCompilerContext && !mb.IsGenericMethodDefinition) {
+ if (!mb.IsGenericMethodDefinition) {
if (methods == null)
methods = new Hashtable ();
if (!methods.ContainsKey (mb))