2008-07-07 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / mcs / modifiers.cs
index 566a8f67604c4610070a1f149b398897ab8babdc..4fb596d1e7d96f91259d51f37d4346bd8083314e 100644 (file)
@@ -25,17 +25,21 @@ namespace Mono.CSharp {
                public const int EXTERN    = 0x0800;
                public const int VOLATILE  = 0x1000;
                public const int UNSAFE    = 0x2000;
-               public const int TOP       = 0x2000;
+               private const int TOP      = 0x2000;
 
                public const int PROPERTY_CUSTOM = 0x4000; // Custom property modifier
-               public const int PARTIAL   = 0x20000;
-               public const int DEFAULT_ACCESS_MODIFER = 0x40000;
 
                //
                // We use this internally to flag that the method contains an iterator
                //
-               public const int METHOD_YIELDS = 0x8000;
-               public const int METHOD_GENERIC = 0x10000;
+               public const int METHOD_YIELDS                  = 0x8000;
+               public const int METHOD_GENERIC                 = 0x10000;
+               public const int PARTIAL                                = 0x20000;
+               public const int DEFAULT_ACCESS_MODIFER = 0x40000;
+               public const int METHOD_EXTENSION               = 0x80000;
+               public const int COMPILER_GENERATED             = 0x100000;
+               public const int BACKING_FIELD                  = 0x200000 | COMPILER_GENERATED;
+               public const int DEBUGGER_HIDDEN                = 0x400000;
 
                public const int Accessibility =
                        PUBLIC | PROTECTED | INTERNAL | PRIVATE;
@@ -82,19 +86,21 @@ namespace Mono.CSharp {
 
                public static string GetDescription (MethodAttributes ma)
                {
-                       if ((ma & MethodAttributes.Assembly) != 0)
+                       ma &= MethodAttributes.MemberAccessMask;
+
+                       if (ma == MethodAttributes.Assembly)
                                return "internal";
 
-                       if ((ma & MethodAttributes.Family) != 0)
+                       if (ma == MethodAttributes.Family)
                                return "protected";
 
-                       if ((ma & MethodAttributes.Public) != 0)
+                       if (ma == MethodAttributes.Public)
                                return "public";
 
-                       if ((ma & MethodAttributes.FamANDAssem) != 0)
+                       if (ma == MethodAttributes.FamANDAssem)
                                return "protected internal";
 
-                       if ((ma & MethodAttributes.Private) != 0)
+                       if (ma == MethodAttributes.Private)
                                return "private";
 
                        throw new NotImplementedException (ma.ToString ());
@@ -162,9 +168,9 @@ namespace Mono.CSharp {
 
                        if ((mod_flags & PUBLIC) != 0)
                                ma |= MethodAttributes.Public;
-                       if ((mod_flags & PRIVATE) != 0)
+                       else if ((mod_flags & PRIVATE) != 0)
                                ma |= MethodAttributes.Private;
-                       if ((mod_flags & PROTECTED) != 0){
+                       else if ((mod_flags & PROTECTED) != 0){
                                if ((mod_flags & INTERNAL) != 0)
                                        ma |= MethodAttributes.FamORAssem;
                                else 
@@ -202,7 +208,7 @@ namespace Mono.CSharp {
                // </summary>
                public static int Check (int allowed, int mod, int def_access, Location l)
                {
-                       int invalid_flags  = (~allowed) & mod;
+                       int invalid_flags  = (~allowed) & (mod & (Modifiers.TOP - 1));
                        int i;
 
                        if (invalid_flags == 0){