using System;
using System.Reflection;
-namespace Mono.CSharp {
+namespace Mono.MonoBASIC {
public class Modifiers {
//
// The ordering of the following 4 constants
// has been carefully done.
//
- public const int PROTECTED = 0x0001;
- public const int PUBLIC = 0x0002;
- public const int PRIVATE = 0x0004;
- public const int INTERNAL = 0x0008;
- public const int NEW = 0x0010;
- public const int ABSTRACT = 0x0020;
- public const int SEALED = 0x0040;
- public const int STATIC = 0x0080;
- public const int READONLY = 0x0100;
- public const int VIRTUAL = 0x0200;
- public const int OVERRIDE = 0x0400;
- public const int EXTERN = 0x0800;
- public const int VOLATILE = 0x1000;
- public const int UNSAFE = 0x2000;
- public const int TOP = 0x2000;
+ public const int PROTECTED = 0x00001;
+ public const int PUBLIC = 0x00002;
+ public const int PRIVATE = 0x00004;
+ public const int INTERNAL = 0x00008;
+ public const int NEW = 0x00010;
+ public const int ABSTRACT = 0x00020;
+ public const int SEALED = 0x00040;
+ public const int STATIC = 0x00080;
+ public const int READONLY = 0x00100;
+ public const int VIRTUAL = 0x00200;
+ public const int OVERRIDE = 0x00400;
+ public const int EXTERN = 0x00800;
+ public const int VOLATILE = 0x01000;
+ public const int UNSAFE = 0x02000;
+ public const int WRITEONLY = 0x04000;
+ // Todo : Shadows needs implementation
+ public const int SHADOWS = 0x08000;
+ public const int DEFAULT = 0x10000;
+ public const int NONVIRTUAL= 0x20000;
+ private const int TOP = 0x20000;
+
public const int Accessibility =
PUBLIC | PROTECTED | INTERNAL | PRIVATE;
switch (i) {
case Modifiers.NEW:
- s = "new"; break;
+ s = "overloads"; break;
case Modifiers.PUBLIC:
s = "public"; break;
case Modifiers.PROTECTED:
s = "protected"; break;
case Modifiers.INTERNAL:
- s = "internal"; break;
+ s = "friend"; break;
case Modifiers.PRIVATE:
s = "private"; break;
case Modifiers.ABSTRACT:
- s = "abstract"; break;
+ s = "mustinherit"; break;
case Modifiers.SEALED:
- s = "sealed"; break;
+ s = "notinheritable"; break;
case Modifiers.STATIC:
- s = "static"; break;
+ s = "shared"; break;
case Modifiers.READONLY:
s = "readonly"; break;
case Modifiers.VIRTUAL:
- s = "virtual"; break;
+ s = "overridable"; break;
case Modifiers.OVERRIDE:
- s = "override"; break;
+ s = "overrides"; break;
case Modifiers.EXTERN:
s = "extern"; break;
case Modifiers.VOLATILE:
s = "volatile"; break;
+ case Modifiers.SHADOWS:
+ s = "shadows"; break;
+ case Modifiers.NONVIRTUAL:
+ s = "notoveridable"; break;
}
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)
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)
fa |= FieldAttributes.Static;
if ((mod_flags & READONLY) != 0)
fa |= FieldAttributes.InitOnly;
-
return fa;
}
public static MethodAttributes MethodAttr (int mod_flags)
{
MethodAttributes ma = 0;
-
if ((mod_flags & PUBLIC) != 0)
ma |= MethodAttributes.Public;
if ((mod_flags & PRIVATE) != 0)
ma |= MethodAttributes.Abstract | MethodAttributes.Virtual |
MethodAttributes.HideBySig;
}
- if ((mod_flags & SEALED) != 0)
+ if ((mod_flags & NONVIRTUAL) != 0)
ma |= MethodAttributes.Final;
if ((mod_flags & VIRTUAL) != 0)
if ((mod_flags & NEW) != 0)
ma |= MethodAttributes.HideBySig;
-
+
+ //if ((mod_flags & SHADOWS) != 0)
+ // needs to be fixed
+
return ma;
}
a = ((a & 2) >> 1) + (a & 5);
a = ((a & 4) >> 2) + (a & 3);
if (a > 1)
- Report.Error (107, l, "More than one protection modifier specified");
+ Report.Error (30176, l, "More than one protection modifier specified");
return mod;
}
-
+
for (i = 1; i < TOP; i <<= 1){
if ((i & invalid_flags) == 0)
continue;
public static void Error_InvalidModifier (Location l, string name)
{
- Report.Error (106, l, "the modifier " + name + " is not valid for this item");
+ Report.Error (30233, l, "the modifier " + name + " is not valid for this item");
}
}
}