This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / gmcs / modifiers.cs
index b6f8d42aef4b6b8d85508ac7b3c83ab1a26cc000..52b2618df140741b7d4ee4865dfe7b05a3552c3f 100755 (executable)
@@ -35,6 +35,8 @@ namespace Mono.CSharp {
 
                public const int Accessibility =
                        PUBLIC | PROTECTED | INTERNAL | PRIVATE;
+               public const int AllowedExplicitImplFlags =
+                       UNSAFE | EXTERN;
                
                static public string Name (int i)
                {
@@ -67,6 +69,8 @@ namespace Mono.CSharp {
                                s = "extern"; break;
                        case Modifiers.VOLATILE:
                                s = "volatile"; break;
+                       case Modifiers.UNSAFE:
+                               s = "unsafe"; break;
                        }
 
                        return s;
@@ -108,7 +112,8 @@ namespace Mono.CSharp {
 
                        // If we do not have static constructors, static methods
                        // can be invoked without initializing the type.
-                       if (!caller.HaveStaticConstructor)
+                       if (!caller.UserDefinedStaticConstructor &&
+                           !(caller is Interface))
                                t |= TypeAttributes.BeforeFieldInit;
                                
                        return t;
@@ -142,7 +147,7 @@ namespace Mono.CSharp {
 
                public static MethodAttributes MethodAttr (int mod_flags)
                {
-                       MethodAttributes ma = 0;
+                       MethodAttributes ma = MethodAttributes.HideBySig;
 
                        if ((mod_flags & PUBLIC) != 0)
                                ma |= MethodAttributes.Public;
@@ -161,8 +166,7 @@ namespace Mono.CSharp {
                        if ((mod_flags & STATIC) != 0)
                                ma |= MethodAttributes.Static;
                        if ((mod_flags & ABSTRACT) != 0){
-                               ma |= MethodAttributes.Abstract | MethodAttributes.Virtual |
-                                       MethodAttributes.HideBySig;
+                               ma |= MethodAttributes.Abstract | MethodAttributes.Virtual;
                        }
                        if ((mod_flags & SEALED) != 0)
                                ma |= MethodAttributes.Final;
@@ -171,15 +175,12 @@ namespace Mono.CSharp {
                                ma |= MethodAttributes.Virtual;
 
                        if ((mod_flags & OVERRIDE) != 0)
-                               ma |= MethodAttributes.Virtual | MethodAttributes.HideBySig;
+                               ma |= MethodAttributes.Virtual;
                        else {
                                if ((ma & MethodAttributes.Virtual) != 0)
                                        ma |= MethodAttributes.NewSlot;
                        }
                        
-                       if ((mod_flags & NEW) != 0)
-                               ma |= MethodAttributes.HideBySig;
-                       
                        return ma;
                }
 
@@ -199,7 +200,7 @@ namespace Mono.CSharp {
                                if ((mod & Modifiers.UNSAFE) != 0){
                                        if (!RootContext.Unsafe){
                                                Report.Error (227, l,
-                                                             "Unsafe code requires the --unsafe command " +
+                                                             "Unsafe code requires the -unsafe command " +
                                                              "line option to be specified");
                                        }
                                }
@@ -229,7 +230,7 @@ namespace Mono.CSharp {
                                return mod;
                        }
                        
-                       for (i = 1; i < TOP; i <<= 1){
+                       for (i = 1; i <= TOP; i <<= 1){
                                if ((i & invalid_flags) == 0)
                                        continue;