Author: zoltan
Date: 2008-01-17 12:56:30 -0500 (Thu, 17 Jan 2008)
New Revision: 93180
Modified:
trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
trunk/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
Log:
2008-01-17 Zoltan Varga <[EMAIL PROTECTED]>
* TypeBuilder.cs (GetConstructorImpl): Add back the code removed by the
last
patch since it is needed when building mscorlib.
Modified: trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog 2008-01-17
17:52:43 UTC (rev 93179)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog 2008-01-17
17:56:30 UTC (rev 93180)
@@ -1,3 +1,8 @@
+2008-01-17 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * TypeBuilder.cs (GetConstructorImpl): Add back the code removed by the
last
+ patch since it is needed when building mscorlib.
+
2008-01-16 Gert Driesen <[EMAIL PROTECTED]>
* TypeBuilder.cs (GetConstructorImpl): Use GetConstructor on created
Modified: trunk/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
2008-01-17 17:52:43 UTC (rev 93179)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
2008-01-17 17:56:30 UTC (rev 93180)
@@ -291,13 +291,56 @@
}
}
- [MonoTODO]
protected override ConstructorInfo GetConstructorImpl
(BindingFlags bindingAttr, Binder binder,
CallingConventions callConvention, Type[] types,
ParameterModifier[] modifiers)
{
check_created ();
+ if (created == typeof (object)) {
+ /*
+ * This happens when building corlib. Calling
created.GetConstructor
+ * would return constructors from the real
mscorlib, instead of the
+ * newly built one.
+ */
+
+ if (ctors == null)
+ return null;
+
+ ConstructorBuilder found = null;
+ int count = 0;
+
+ foreach (ConstructorBuilder cb in ctors) {
+ if (callConvention !=
CallingConventions.Any && cb.CallingConvention != callConvention)
+ continue;
+ found = cb;
+ count++;
+ }
+
+ if (count == 0)
+ return null;
+ if (types == null) {
+ if (count > 1)
+ throw new
AmbiguousMatchException ();
+ return found;
+ }
+ MethodBase[] match = new MethodBase [count];
+ if (count == 1)
+ match [0] = found;
+ else {
+ count = 0;
+ foreach (ConstructorInfo m in ctors) {
+ if (callConvention !=
CallingConventions.Any && m.CallingConvention != callConvention)
+ continue;
+ match [count++] = m;
+ }
+ }
+ if (binder == null)
+ binder = Binder.DefaultBinder;
+ return (ConstructorInfo) binder.SelectMethod
(bindingAttr, match,
+
types, modifiers);
+ }
+
return created.GetConstructor (bindingAttr, binder,
callConvention, types, modifiers);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches