2004-09-15 Marek Safar <marek.safar@seznam.cz>
[mono.git] / mcs / mcs / modifiers.cs
index 912b1429e0d8fdc2ac453c42516cf7b179df7139..922d67dab4850448a94284461ff98e32000683f0 100755 (executable)
@@ -68,6 +68,8 @@ namespace Mono.CSharp {
                                s = "extern"; break;
                        case Modifiers.VOLATILE:
                                s = "volatile"; break;
+                       case Modifiers.UNSAFE:
+                               s = "unsafe"; break;
                        }
 
                        return s;
@@ -109,7 +111,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.Kind != Kind.Interface))
                                t |= TypeAttributes.BeforeFieldInit;
                                
                        return t;
@@ -143,7 +146,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;
@@ -162,8 +165,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;
@@ -172,15 +174,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;
                }
 
@@ -200,7 +199,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");
                                        }
                                }
@@ -230,7 +229,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;