dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnet/image meta_types.c,1.12,1.13


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnet/image meta_types.c,1.12,1.13
Date: Mon, 24 Nov 2003 10:31:21 +0000

Update of /cvsroot/dotgnu-pnet/pnet/image
In directory subversions:/tmp/cvs-serv23848/image

Modified Files:
        meta_types.c 
Log Message:


ILTypeIdentical: check for class identity in a way that will work
even if "redo" items are involved and the classes haven't been
linked together yet.


Index: meta_types.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_types.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** meta_types.c        16 Jul 2003 23:44:15 -0000      1.12
--- meta_types.c        24 Nov 2003 10:31:19 -0000      1.13
***************
*** 446,449 ****
--- 446,515 ----
  }
  
+ /*
+  * Determine if two classes are identical.
+  */
+ static int ClassIdentical(ILClass *classInfo1, ILClass *classInfo2)
+ {
+       const char *namespace1;
+       const char *namespace2;
+       ILClass *parent1;
+       ILClass *parent2;
+ 
+       /* Resolve the classes as far as possible */
+       classInfo1 = ILClassResolve(classInfo1);
+       classInfo2 = ILClassResolve(classInfo2);
+       if(classInfo1 == classInfo2)
+       {
+               return 1;
+       }
+ 
+       /* If there are no "redo" items, then there is no way to match */
+       if(classInfo1->programItem.image->context->numRedoItems == 0)
+       {
+               return 0;
+       }
+ 
+       /* If neither is a reference, then they cannot be identical */
+       if(!ILClassIsRef(classInfo1) && !ILClassIsRef(classInfo2))
+       {
+               return 0;
+       }
+ 
+       /* Check for name identity */
+       if(strcmp(ILClass_Name(classInfo1), ILClass_Name(classInfo2)) != 0)
+       {
+               return 0;
+       }
+       namespace1 = ILClass_Namespace(classInfo1);
+       namespace2 = ILClass_Namespace(classInfo2);
+       if(namespace1 && namespace2)
+       {
+               if(strcmp(namespace1, namespace2) != 0)
+               {
+                       return 0;
+               }
+       }
+       else if(namespace1 != namespace2)
+       {
+               return 0;
+       }
+ 
+       /* Check the nesting scope levels */
+       parent1 = ILClassGetNestedParent(classInfo1);
+       parent2 = ILClassGetNestedParent(classInfo2);
+       if(parent1 && parent2)
+       {
+               return ClassIdentical(parent1, parent2);
+       }
+       else if(parent1 != parent2)
+       {
+               return 0;
+       }
+ 
+       /* The two classes are identical, or will be after we perform
+          "redo" operations at the end of the loading process */
+       return 1;
+ }
+ 
  int ILTypeIdentical(ILType *type1, ILType *type2)
  {
***************
*** 479,484 ****
                if(ILType_IsClass(type2))
                {
!                       return (ILClassResolve(ILType_ToClass(type1)) ==
!                                       ILClassResolve(ILType_ToClass(type2)));
                }
                else
--- 545,550 ----
                if(ILType_IsClass(type2))
                {
!                       return ClassIdentical(ILType_ToClass(type1),
!                                                                 
ILType_ToClass(type2));
                }
                else
***************
*** 491,496 ****
                if(ILType_IsValueType(type2))
                {
!                       return (ILClassResolve(ILType_ToClass(type1)) ==
!                                       ILClassResolve(ILType_ToClass(type2)));
                }
                else
--- 557,562 ----
                if(ILType_IsValueType(type2))
                {
!                       return ClassIdentical(ILType_ToValueType(type1),
!                                                                 
ILType_ToValueType(type2));
                }
                else





reply via email to

[Prev in Thread] Current Thread [Next in Thread]