2003-01-30 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 8 Apr 2003 22:55:47 +0000 (22:55 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 8 Apr 2003 22:55:47 +0000 (22:55 -0000)
* class.cs: Handle error 549: do not allow virtual methods in
sealed classes.

svn path=/trunk/mcs/; revision=13366

mcs/mcs/ChangeLog
mcs/mcs/class.cs

index 03ad5bd1b0853ef5e515f94ec2a66373c3c284c2..3d667fbde58e595587a0bc662d1673f704beed82 100755 (executable)
@@ -1,3 +1,8 @@
+2003-01-30  Miguel de Icaza  <miguel@ximian.com>
+
+       * class.cs: Handle error 549: do not allow virtual methods in
+       sealed classes. 
+
 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
 
        * decl.cs: Check access levels when resolving types
index c57f42831faf9a3cd37fd2266aa4b96564c5f916..c4e6ebd720861fc3a99cc40404473fb10c2c0166 100755 (executable)
@@ -3325,6 +3325,13 @@ namespace Mono.CSharp {
                        if (MemberType == null)
                                return false;
 
+                       if ((parent.ModFlags & Modifiers.SEALED) != 0){
+                               if ((ModFlags & (Modifiers.VIRTUAL|Modifiers.ABSTRACT)) != 0){
+                                       Report.Error (549, Location, "Virtual method can not be contained in sealed class");
+                                       return false;
+                               }
+                       }
+                       
                        // verify accessibility
                        if (!parent.AsAccessible (MemberType, ModFlags)) {
                                if (this is Property)