X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fmodifiers.cs;h=a5cf6f62c036aa69c09f8546ef6b5cbd5fdc0024;hb=2b808a73a435ae7c50a5edbd98eb12ba96fef4b5;hp=a5ad3d3646e823006305d3a8f846ebc5fc59f19a;hpb=e3fef3523b673346f9255e0070f1292677c78d1b;p=mono.git diff --git a/mcs/mcs/modifiers.cs b/mcs/mcs/modifiers.cs index a5ad3d3646e..a5cf6f62c03 100755 --- a/mcs/mcs/modifiers.cs +++ b/mcs/mcs/modifiers.cs @@ -66,12 +66,11 @@ namespace Mono.CSharp { return s; } - public static TypeAttributes TypeAttr (int mod_flags, TypeContainer caller) + public static TypeAttributes TypeAttr (int mod_flags, bool is_toplevel) { TypeAttributes t = 0; - bool top_level = caller.IsTopLevel; - if (top_level){ + if (is_toplevel){ if ((mod_flags & PUBLIC) != 0) t |= TypeAttributes.Public; if ((mod_flags & PRIVATE) != 0) @@ -94,6 +93,13 @@ namespace Mono.CSharp { if ((mod_flags & ABSTRACT) != 0) t |= TypeAttributes.Abstract; + return t; + } + + public static TypeAttributes TypeAttr (int mod_flags, TypeContainer caller) + { + TypeAttributes t = TypeAttr (mod_flags, caller.IsTopLevel); + // If we do not have static constructors, static methods // can be invoked without initializing the type. if (!caller.HaveStaticConstructor) @@ -110,12 +116,15 @@ namespace Mono.CSharp { fa |= FieldAttributes.Public; if ((mod_flags & PRIVATE) != 0) fa |= FieldAttributes.Private; - if ((mod_flags & PROTECTED) != 0 && (mod_flags & INTERNAL) != 0) - fa |= FieldAttributes.FamORAssem; - if ((mod_flags & PROTECTED) != 0) - fa |= FieldAttributes.Family; - if ((mod_flags & INTERNAL) != 0) - fa |= FieldAttributes.Assembly; + if ((mod_flags & PROTECTED) != 0){ + if ((mod_flags & INTERNAL) != 0) + fa |= FieldAttributes.FamORAssem; + else + fa |= FieldAttributes.Family; + } else { + if ((mod_flags & INTERNAL) != 0) + fa |= FieldAttributes.Assembly; + } if ((mod_flags & STATIC) != 0) fa |= FieldAttributes.Static; @@ -218,11 +227,15 @@ namespace Mono.CSharp { if ((i & invalid_flags) == 0) continue; - Report.Error (106, l, "the modifier `" + Name (i) + - "' is not valid for this item"); + Error_InvalidModifier (l, Name (i)); } return allowed & mod; } + + public static void Error_InvalidModifier (Location l, string name) + { + Report.Error (106, l, "the modifier " + name + " is not valid for this item"); + } } }