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

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

[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_internal.h,1.10,1.11 cs_i


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_internal.h,1.10,1.11 cs_invoke.tc,1.12,1.13 cs_lookup.c,1.13,1.14
Date: Fri, 08 Nov 2002 19:05:39 -0500

Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv6696/cscc/csharp

Modified Files:
        cs_internal.h cs_invoke.tc cs_lookup.c 
Log Message:


When a candidate method is found in a child class, ignore all candidates
in the parent, even if the parent candidates are "better".


Index: cs_internal.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_internal.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** cs_internal.h       27 Oct 2002 14:41:04 -0000      1.10
--- cs_internal.h       9 Nov 2002 00:05:36 -0000       1.11
***************
*** 136,139 ****
--- 136,144 ----
  
  /*
+  * Determine if "info1" is a base type for "info2".
+  */
+ int CSIsBaseTypeFor(ILClass *info1, ILClass *info2);
+ 
+ /*
   * Get the scope to use for access checks in the current context.
   */

Index: cs_invoke.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_invoke.tc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** cs_invoke.tc        27 Oct 2002 14:41:04 -0000      1.12
--- cs_invoke.tc        9 Nov 2002 00:05:36 -0000       1.13
***************
*** 316,319 ****
--- 316,392 ----
  }
  
+ /*
+  * Reduce a method group to a set of candidates.
+  */
+ static void ReduceMethodGroup(ILGenInfo *info, CSEvalArg *args,
+                                                         int numArgs, 
CSSemValue *method)
+ {
+       unsigned long itemNum;
+       int candidateForm;
+       ILProgramItem *itemInfo;
+       ILMember *member;
+       ILClass *lowestOwner = 0;
+       ILClass *owner;
+ 
+       /* Remove methods that aren't candidates */
+       itemNum = 0;
+       while((itemInfo = CSGetGroupMember(CSSemGetGroup(*method), itemNum)) != 
0)
+       {
+               candidateForm = CSItemIsCandidate(info, itemInfo, args, 
numArgs);
+               if(candidateForm)
+               {
+                       CSSetGroupMemberForm(CSSemGetGroup(*method), itemNum,
+                                                                candidateForm);
+                       ++itemNum;
+                       member = ILProgramItemToMember(itemInfo);
+                       if(member)
+                       {
+                               owner = ILClassResolve(ILMember_Owner(member));
+                               if(!lowestOwner)
+                               {
+                                       lowestOwner = owner;
+                               }
+                               else if(CSIsBaseTypeFor(lowestOwner, owner))
+                               {
+                                       lowestOwner = owner;
+                               }
+                       }
+               }
+               else
+               {
+                       CSSemModifyGroup(*method, CSRemoveGroupMember
+                                                               
(CSSemGetGroup(*method), itemNum));
+               }
+       }
+ 
+       /* Remove candidates in base classes */
+       if(lowestOwner)
+       {
+               itemNum = 0;
+               while((itemInfo = CSGetGroupMember(CSSemGetGroup(*method), 
itemNum))
+                                       != 0)
+               {
+                       member = ILProgramItemToMember(itemInfo);
+                       if(member)
+                       {
+                               owner = ILClassResolve(ILMember_Owner(member));
+                               if(owner != lowestOwner)
+                               {
+                                       CSSemModifyGroup(*method, 
CSRemoveGroupMember
+                                                                               
(CSSemGetGroup(*method), itemNum));
+                               }
+                               else
+                               {
+                                       ++itemNum;
+                               }
+                       }
+                       else
+                       {
+                               ++itemNum;
+                       }
+               }
+       }
+ }
+ 
  %}
  
***************
*** 332,336 ****
        unsigned long itemNum;
        char *itemName;
-       int candidateForm;
        ILNode_MethodDeclaration *caller;
  
--- 405,408 ----
***************
*** 389,408 ****
  
        /* Find the set of candidate methods */
!       itemNum = 0;
!       while((itemInfo = CSGetGroupMember(CSSemGetGroup(method), itemNum)) != 
0)
!       {
!               candidateForm = CSItemIsCandidate(info, itemInfo, args, 
numArgs);
!               if(candidateForm)
!               {
!                       CSSetGroupMemberForm(CSSemGetGroup(method), itemNum,
!                                                                candidateForm);
!                       ++itemNum;
!               }
!               else
!               {
!                       CSSemModifyGroup(method, CSRemoveGroupMember
!                                                               
(CSSemGetGroup(method), itemNum));
!               }
!       }
  
        /* If there are no candidates left, then bail out */
--- 461,465 ----
  
        /* Find the set of candidate methods */
!       ReduceMethodGroup(info, args, numArgs, &method);
  
        /* If there are no candidates left, then bail out */

Index: cs_lookup.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lookup.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** cs_lookup.c 27 Oct 2002 14:41:04 -0000      1.13
--- cs_lookup.c 9 Nov 2002 00:05:36 -0000       1.14
***************
*** 405,412 ****
  }
  
! /*
!  * Determine if "info1" is a base type for "info2".
!  */
! static int IsBaseTypeFor(ILClass *info1, ILClass *info2)
  {
        if(ILClassResolve(info1) == ILClassResolve(info2))
--- 405,409 ----
  }
  
! int CSIsBaseTypeFor(ILClass *info1, ILClass *info2)
  {
        if(ILClassResolve(info1) == ILClassResolve(info2))
***************
*** 495,499 ****
                        while(testMember != 0)
                        {
!                               if(IsBaseTypeFor(testMember->owner, 
member->owner))
                                {
                                        /* "testMember" is in a base type of 
"member"'s type */
--- 492,496 ----
                        while(testMember != 0)
                        {
!                               if(CSIsBaseTypeFor(testMember->owner, 
member->owner))
                                {
                                        /* "testMember" is in a base type of 
"member"'s type */
***************
*** 511,515 ****
                                        }
                                }
!                               else if(IsBaseTypeFor(member->owner, 
testMember->owner))
                                {
                                        /* "member" is in a base type of 
"testMember"'s type */
--- 508,512 ----
                                        }
                                }
!                               else if(CSIsBaseTypeFor(member->owner, 
testMember->owner))
                                {
                                        /* "member" is in a base type of 
"testMember"'s type */





reply via email to

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