svn path=/branches/mono-1-1-9/mcs/; revision=51212
[mono.git] / mcs / mcs / modifiers.cs
index 922d67dab4850448a94284461ff98e32000683f0..e5c73c5ae5802ff355c9591650094514cffa51b8 100644 (file)
@@ -27,6 +27,8 @@ namespace Mono.CSharp {
                public const int UNSAFE    = 0x2000;
                public const int TOP       = 0x2000;
 
+               public const int PROPERTY_CUSTOM = 0x4000; // Custom property modifier
+
                //
                // We use this internally to flag that the method contains an iterator
                //
@@ -75,6 +77,26 @@ namespace Mono.CSharp {
                        return s;
                }
 
+               public static string GetDescription (MethodAttributes ma)
+               {
+                       if ((ma & MethodAttributes.Assembly) != 0)
+                               return "internal";
+
+                       if ((ma & MethodAttributes.Family) != 0)
+                               return "protected";
+
+                       if ((ma & MethodAttributes.Public) != 0)
+                               return "public";
+
+                       if ((ma & MethodAttributes.FamANDAssem) != 0)
+                               return "protected internal";
+
+                       if ((ma & MethodAttributes.Private) != 0)
+                               return "private";
+
+                       throw new NotImplementedException (ma.ToString ());
+               }
+
                public static TypeAttributes TypeAttr (int mod_flags, bool is_toplevel)
                {
                        TypeAttributes t = 0;
@@ -197,11 +219,7 @@ namespace Mono.CSharp {
                                int a = mod;
 
                                if ((mod & Modifiers.UNSAFE) != 0){
-                                       if (!RootContext.Unsafe){
-                                               Report.Error (227, l,
-                                                             "Unsafe code requires the -unsafe command " +
-                                                             "line option to be specified");
-                                       }
+                                       RootContext.CheckUnsafeOption (l);
                                }
                                
                                //
@@ -241,7 +259,7 @@ namespace Mono.CSharp {
 
                public static void Error_InvalidModifier (Location l, string name)
                {
-                       Report.Error (106, l, "the modifier " + name + " is not valid for this item");
+                       Report.Error (106, l, "The modifier `" + name + "' is not valid for this item");
                }
        }
 }