Errrr.... there shouldn't have been a return TRUE at the end of that
case. The while loop confused me by being clever and only exiting via
returns.

On Fri, Sep 24, 2010 at 6:55 PM, Vincent Povirk <madewokh...@gmail.com> wrote:
> This patch copies the type comparison logic for FNPTR from metadata.c
> to reflection.c, so that the recursive type comparisons have different
> semantics.
>
> I am in way over my head here, but it seems to work in that my test
> program takes ever so slightly longer to crash.
>
diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c
index 3ba44ea..0be8a6c 100644
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -6148,6 +6148,33 @@ mymono_metadata_type_equal (MonoType *t1, MonoType *t2)
 	case MONO_TYPE_VAR:
 	case MONO_TYPE_MVAR:
 		return t1->data.generic_param == t2->data.generic_param;
+	case MONO_TYPE_FNPTR: {
+		gpointer iter1 = 0, iter2 = 0;
+		if (t1->data.method == t2->data.method)
+			return TRUE;
+		if (t1->data.method->call_convention != t2->data.method->call_convention)
+			return FALSE;
+		if (t1->data.method->sentinelpos != t2->data.method->sentinelpos)
+			return FALSE;
+		if (t1->data.method->hasthis != t2->data.method->hasthis)
+			return FALSE;
+		if (t1->data.method->explicit_this != t2->data.method->explicit_this)
+			return FALSE;
+		if (! mymono_metadata_type_equal (t1->data.method->ret, t2->data.method->ret))
+			return FALSE;
+		if (t1->data.method->param_count != t2->data.method->param_count)
+			return FALSE;
+
+		while (TRUE) {
+			MonoType *p1 = mono_signature_get_params (t1->data.method, &iter1);
+			MonoType *p2 = mono_signature_get_params (t1->data.method, &iter2);
+
+			if (p1 == NULL || p2 == NULL)
+				return (p1 == p2);
+			if (! mymono_metadata_type_equal (p1, p2))
+				return FALSE;
+		}
+	}
 	default:
 		g_error ("implement type compare for %0x!", t1->type);
 		return FALSE;
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to