+2009-07-23 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * FieldOnTypeBuilderInst.cs: Implement MetadataToken and FieldToken
+ for compiler context.
+
+ * TypeBuilder.cs: Make FieldBuilder related fields internal.
+
2009-07-23 Rodrigo Kumpera <rkumpera@novell.com>
* PropertyOnTypeBuilderInst.cs: Use TypeBuilder::GetMethod instead of
}
}
+ public override int MetadataToken {
+ get {
+ if (!((ModuleBuilder)instantiation.generic_type.Module).assemblyb.IsCompilerContext)
+ throw new InvalidOperationException ();
+ return fb.MetadataToken;
+ }
+ }
+
public override Type FieldType {
get {
- // FIXME:
- throw new NotImplementedException ();
+ if (!((ModuleBuilder)instantiation.generic_type.Module).assemblyb.IsCompilerContext)
+ throw new NotSupportedException ();
+ return instantiation.InflateType (fb.FieldType);
}
}
internal MethodBuilder[] methods;
private ConstructorBuilder[] ctors;
internal PropertyBuilder[] properties;
- private int num_fields;
- private FieldBuilder[] fields;
+ internal int num_fields;
+ internal FieldBuilder[] fields;
private EventBuilder[] events;
private CustomAttributeBuilder[] cattrs;
internal TypeBuilder[] subtypes;
+2009-07-23 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * MonoGenericClass.cs: Kill GetFields_internal and implement it
+ all in terms of managed code.
+
2009-07-23 Rodrigo Kumpera <rkumpera@novell.com>
* MonoGenericClass.cs: Kill GetMethods_internal and implement it
[MethodImplAttribute(MethodImplOptions.InternalCall)]
protected extern ConstructorInfo[] GetConstructors_internal (Type reflected_type);
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- protected extern FieldInfo[] GetFields_internal (Type reflected_type);
-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
protected extern EventInfo[] GetEvents_internal (Type reflected_type);
do {
MonoGenericClass gi = current_type as MonoGenericClass;
if (gi != null)
- l.AddRange (gi.GetFields_impl (bf, this));
+ l.AddRange (gi.GetFieldsInternal (bf, this));
else if (current_type is TypeBuilder)
l.AddRange (current_type.GetFields (bf));
else {
return result;
}
- protected FieldInfo[] GetFields_impl (BindingFlags bf, Type reftype)
+ FieldInfo[] GetFieldsInternal (BindingFlags bf, MonoGenericClass reftype)
{
+ if (generic_type.num_fields == 0)
+ return new FieldInfo [0];
+
ArrayList l = new ArrayList ();
bool match;
FieldAttributes fattrs;
initialize ();
- FieldInfo[] fields = GetFields_internal (reftype);
-
- for (int i = 0; i < fields.Length; i++) {
- FieldInfo c = fields [i];
+ for (int i = 0; i < generic_type.num_fields; i++) {
+ FieldInfo c = generic_type.fields [i];
match = false;
fattrs = c.Attributes;
}
if (!match)
continue;
- l.Add (c);
+ l.Add (TypeBuilder.GetField (this, c));
}
+
FieldInfo[] result = new FieldInfo [l.Count];
l.CopyTo (result);
return result;