Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2008-08-12 23:46:06 +0400
committerZoltan Varga <vargaz@gmail.com>2008-08-12 23:46:06 +0400
commitd7b1a66b945f37e7a62ce28a2cbb4618dbca842b (patch)
treeef6f41f42b1ba7f40e6b19010360d68b4df3240a
parent7b06e01c8ff28eefffb07a62fb09577c1e73bbe7 (diff)
Merge r110288 from HEAD.mono-2-0-p2
svn path=/branches/mono-2-0/mcs/; revision=110291
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ChangeLog5
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs16
2 files changed, 20 insertions, 1 deletions
diff --git a/mcs/class/corlib/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/System.Reflection.Emit/ChangeLog
index d1fc3f81976..df8bab39c61 100644
--- a/mcs/class/corlib/System.Reflection.Emit/ChangeLog
+++ b/mcs/class/corlib/System.Reflection.Emit/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-12 Zoltan Varga <vargaz@gmail.com>
+
+ * TypeBuilder.cs (CreateType): Avoid creating a default ctor if the
+ type has a constructor defined using DefineMethod. Fixes #416632.
+
2008-07-11 Marek Safar <marek.safar@gmail.com>
* ModuleBuilder.cs: Couple of micro optimizations.
diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
index e3042138882..f1790048c80 100644
--- a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
@@ -751,6 +751,20 @@ namespace System.Reflection.Emit
}
return false;
}
+
+ // Return whenever this type has a ctor defined using DefineMethod ()
+ private bool has_ctor_method () {
+ MethodAttributes ctor_attrs = MethodAttributes.SpecialName | MethodAttributes.RTSpecialName;
+
+ for (int i = 0; i < num_methods; ++i) {
+ MethodBuilder mb = (MethodBuilder)(methods[i]);
+
+ if (mb.Name == ConstructorInfo.ConstructorName && (mb.Attributes & ctor_attrs) == ctor_attrs)
+ return true;
+ }
+
+ return false;
+ }
public Type CreateType()
{
@@ -804,7 +818,7 @@ namespace System.Reflection.Emit
// On classes, define a default constructor if not provided
//
if (!(IsInterface || IsValueType) && (ctors == null) && (tname != "<Module>") &&
- (GetAttributeFlagsImpl () & TypeAttributes.Abstract | TypeAttributes.Sealed) != (TypeAttributes.Abstract | TypeAttributes.Sealed))
+ (GetAttributeFlagsImpl () & TypeAttributes.Abstract | TypeAttributes.Sealed) != (TypeAttributes.Abstract | TypeAttributes.Sealed) && !has_ctor_method ())
DefineDefaultConstructor (MethodAttributes.Public);
if (ctors != null){