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_gather.c,1.45,1.46


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_gather.c,1.45,1.46
Date: Fri, 08 Aug 2003 20:29:50 -0400

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

Modified Files:
        cs_gather.c 
Log Message:


Fix a bug where "final virtual" was being added to methods that
weren't interface implementations.


Index: cs_gather.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_gather.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -r1.45 -r1.46
*** cs_gather.c 19 Jul 2003 00:48:37 -0000      1.45
--- cs_gather.c 9 Aug 2003 00:29:48 -0000       1.46
***************
*** 2022,2025 ****
--- 2022,2068 ----
  
  /*
+  * Fix up methods with the "public final virtual" attributes that
+  * we thought were interface member overrides that turned out not to
+  * be because there is an explicit override with the same signature.
+  */
+ static void FixNonInterfaceMethods(ILClass *classInfo)
+ {
+       ILMethod *method = 0;
+       ILOverride *override;
+       ILMethod *overMethod;
+       while((method = (ILMethod *)ILClassNextMemberByKind
+                       (classInfo, (ILMember *)method, 
IL_META_MEMBERKIND_METHOD)) != 0)
+       {
+               /* Skip methods that aren't marked as "public final virtual" */
+               if(!ILMethod_IsPublic(method) || !ILMethod_IsFinal(method) ||
+                  !ILMethod_IsVirtual(method))
+               {
+                       continue;
+               }
+ 
+               /* Look for an "Override" block with the same signature */
+               override = 0;
+               while((override = (ILOverride *)ILClassNextMemberByKind
+                                       (classInfo, (ILMember *)override,
+                                        IL_META_MEMBERKIND_OVERRIDE)) != 0)
+               {
+                       overMethod = ILOverrideGetDecl(override);
+                       if(!strcmp(ILMethod_Name(overMethod), 
ILMethod_Name(method)) &&
+                          ILTypeIdentical(ILMethod_Signature(overMethod),
+                                                          
ILMethod_Signature(method)))
+                       {
+                               /* We've found a match, so assume that the
+                                  "final virtual" flags are incorrect */
+                               ILMemberSetAttrs((ILMember *)method,
+                                                                
IL_META_METHODDEF_VIRTUAL |
+                                                                
IL_META_METHODDEF_NEW_SLOT |
+                                                                
IL_META_METHODDEF_FINAL, 0);
+                               break;
+                       }
+               }
+       }
+ }
+ 
+ /*
   * Create the members of a class node.
   */
***************
*** 2133,2136 ****
--- 2176,2183 ----
                CheckAbstractOverrides(info, classInfo, classNode);
        }
+ 
+       /* Fix up "public final virtual" methods that we thought we
+          interface implementations but which turn out not to be */
+       FixNonInterfaceMethods(classInfo);
  
        /* Return to the original scope */





reply via email to

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