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

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

[Dotgnu-pnet-commits] CVS: pnet/engine lib_type.c,1.38,1.39


From: Richard Baumann <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine lib_type.c,1.38,1.39
Date: Mon, 28 Jul 2003 13:46:00 -0400

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv8107/engine

Modified Files:
        lib_type.c 
Log Message:
Fix an ambiguity bug in the GetMemberImpl internal call.


Index: lib_type.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_type.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** lib_type.c  27 Jul 2003 04:56:06 -0000      1.38
--- lib_type.c  28 Jul 2003 17:45:58 -0000      1.39
***************
*** 1981,1988 ****
        char *nameUtf8;
        ILMember *member;
!       ILMember *otherMember;
        ILProgramItem *foundItem;
        ILNestedInfo *nested;
        ILClass *child;
  
        /* Validate the parameters */
--- 1981,1990 ----
        char *nameUtf8;
        ILMember *member;
!       ILMember *other;
        ILProgramItem *foundItem;
+       ILProgramItem *foundExact;
        ILNestedInfo *nested;
        ILClass *child;
+       int inexactIsAmbig;
  
        /* Validate the parameters */
***************
*** 2022,2025 ****
--- 2024,2029 ----
        /* Scan the class hierarchy looking for a member match */
        foundItem = 0;
+       foundExact = 0;
+       inexactIsAmbig = 0;
        do
        {
***************
*** 2032,2037 ****
                                if(strcmp(member->name, nameUtf8) != 0)
                                {
!                                       member = member->nextMember;
!                                       continue;
                                }
                        }
--- 2036,2040 ----
                                if(strcmp(member->name, nameUtf8) != 0)
                                {
!                                       goto advance;
                                }
                        }
***************
*** 2040,2045 ****
                                if(ILStrICmp(member->name, nameUtf8) != 0)
                                {
!                                       member = member->nextMember;
!                                       continue;
                                }
                        }
--- 2043,2047 ----
                                if(ILStrICmp(member->name, nameUtf8) != 0)
                                {
!                                       goto advance;
                                }
                        }
***************
*** 2048,2053 ****
                        if(!MemberTypeMatch(member, memberTypes))
                        {
!                               member = member->nextMember;
!                               continue;
                        }
        
--- 2050,2054 ----
                        if(!MemberTypeMatch(member, memberTypes))
                        {
!                               goto advance;
                        }
        
***************
*** 2055,2109 ****
                        if(!BindingAttrMatch(member, bindingAttrs, callConv))
                        {
!                               member = member->nextMember;
!                               continue;
                        }
!       
!                       /* Filter based on the parameter types */
!                       if(types != 0)
                        {
!                               if(member->kind == IL_META_MEMBERKIND_METHOD ||
!                                  member->kind == IL_META_MEMBERKIND_PROPERTY)
                                {
!                                       if(!ParameterTypeMatch
!                                                       (thread, 
member->programItem.image,
!                                                    member->signature, 
(System_Array *)types,
!                                                    (bindingAttrs & 
BF_ExactBinding) != 0))
                                        {
!                                               member = member->nextMember;
!                                               continue;
                                        }
                                }
                        }
-       
-                       /* Check that we have reflection access for this member 
*/
-                       if(!_ILClrCheckAccess(thread, (ILClass *)0, member))
-                       {
-                               member = member->nextMember;
-                               continue;
-                       }
-       
                        /* This is a candidate member */
!                       if(foundItem)
                        {
!                               otherMember=ILProgramItemToMember(foundItem);
!                                       
!                               if(ILMemberGetKind(member) == 
ILMemberGetKind(otherMember) &&
!                                 (otherMember=CheckMemberOverride(otherMember, 
member))!=NULL)
!                               {
!                                       foundItem = &(otherMember->programItem);
!                                       member = member->nextMember;
!                                       continue;                               
        
                                }
                                /* The member match is ambiguous */
!                       ambiguous:
!                               ILExecThreadThrowSystem
!                                               (thread, 
"System.Reflection.AmbiguousMatchException",
!                                                (const char *)0);
!                               return 0;
                        }
                        foundItem = &(member->programItem);
!       
                        /* Advance to the next member */
                        member = member->nextMember;
                }
  
--- 2056,2143 ----
                        if(!BindingAttrMatch(member, bindingAttrs, callConv))
                        {
!                               goto advance;
                        }
! 
!                       /* Check that we have reflection access for this member 
*/
!                       if(!_ILClrCheckAccess(thread, (ILClass *)0, member))
                        {
!                               goto advance;
!                       }
! 
!                       /* Filter based on the parameter types */
!                       if(types &&
!                          (member->kind == IL_META_MEMBERKIND_METHOD ||
!                           member->kind == IL_META_MEMBERKIND_PROPERTY))
!                       {
!                               /* Check for an exact match */
!                               if(!ParameterTypeMatch(thread, 
member->programItem.image,
!                                                      member->signature, 
types, 1))
                                {
!                                       /* Check for an inexact match if 
neccessary */
!                                       if(!foundExact && (bindingAttrs & 
BF_ExactBinding) == 0)
                                        {
!                                               if(!ParameterTypeMatch(thread,
!                                                                      
member->programItem.image,
!                                                                      
member->signature, types, 0))
!                                               {
!                                                       goto advance;
!                                               }
!                                       }
!                                       else
!                                       {
!                                               goto advance;
                                        }
                                }
+                               else
+                               {
+                                       /* This is a candidate member */
+                                       if(foundExact)
+                                       {
+                                               other = 
ILProgramItemToMember(foundExact);
+                                               if(member->kind == other->kind 
&&
+                                                  (other = 
CheckMemberOverride(other, member)))
+                                               {
+                                                       foundExact = 
&(other->programItem);
+                                                       goto advance;
+                                               }
+                                               /* The member match is 
ambiguous */
+                                               goto ambiguous;
+                                       }
+                                       foundExact = &(member->programItem);
+                               }
                        }
                        /* This is a candidate member */
!                       if(!foundExact && foundItem)
                        {
!                               other = ILProgramItemToMember(foundItem);
! 
!                               if(member->kind == other->kind &&
!                                  (other = CheckMemberOverride(other, member)))
!                               {
!                                       foundItem = &(other->programItem);
!                                       goto advance;
                                }
                                /* The member match is ambiguous */
!                               inexactIsAmbig = 1;
                        }
                        foundItem = &(member->programItem);
! 
!               advance:
                        /* Advance to the next member */
                        member = member->nextMember;
+ 
+                       /* Final ambiguouity check */
+                       if(!member && !foundExact && inexactIsAmbig)
+                       {
+                               goto ambiguous;
+                       }
+                       continue;
+ 
+               ambiguous:
+                       /* The member match is ambiguous */
+                       ILExecThreadThrowSystem
+                                       (thread, 
"System.Reflection.AmbiguousMatchException",
+                                        (const char *)0);
+                       return 0;
                }
  
***************
*** 2163,2167 ****
  
        /* Return the item that was found to the caller */
!       if(foundItem)
        {
                return ItemToClrObject(thread, foundItem);
--- 2197,2205 ----
  
        /* Return the item that was found to the caller */
!       if(foundExact)
!       {
!               return ItemToClrObject(thread, foundExact);
!       }
!       else if(foundItem)
        {
                return ItemToClrObject(thread, foundItem);





reply via email to

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