2005-01-26 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
[mono.git] / mcs / mbas / class.cs
index c2797ba1830a2859f33e3c8fc4ab692646049af4..0c715930afd7b03620ce72473e3db3cd8784f785 100644 (file)
@@ -143,17 +143,18 @@ namespace Mono.MonoBASIC {
                public TypeContainer (TypeContainer parent, string name, Attributes attrs, Location l)
                        : base (parent, name, attrs, l)
                {
-                       string n;
                        types = new ArrayList ();
+                       
+                       base_class_name = null;
 
+                       /* string n;
+                         
                        if (parent == null)
                                n = "";
                        else
                                n = parent.Name;
 
-                       base_class_name = null;
-                       
-                       //Console.WriteLine ("New class " + name + " inside " + n);
+                       Console.WriteLine ("New class " + name + " inside " + n);*/
                }
 
                public AdditionResult AddConstant (Const constant)
@@ -364,6 +365,13 @@ namespace Mono.MonoBASIC {
                        AdditionResult res;
                        string basename = prop.Name;
 
+                       string fullname = Name + "." + basename;
+
+                       Object value = defined_names [fullname];
+
+                       if (value != null && (!(value is Property)))
+                               return AdditionResult.NameExists;
+
                        if ((res = IsValid (basename)) != AdditionResult.Success)
                                return res;
 
@@ -374,7 +382,9 @@ namespace Mono.MonoBASIC {
                                properties.Insert (0, prop);
                        else
                                properties.Add (prop);
-                       DefineName (Name + "." + basename, prop);
+
+                       if (value == null)
+                               DefineName (Name + "." + basename, prop);
 
                        return AdditionResult.Success;
                }
@@ -527,7 +537,7 @@ namespace Mono.MonoBASIC {
                public bool EmitFieldInitializers (EmitContext ec)
                {
                        ArrayList fields;
-                       ILGenerator ig = ec.ig;
+                       //ILGenerator ig = ec.ig;
                        Expression instance_expr;
                        
                        if (ec.IsStatic){
@@ -813,7 +823,7 @@ namespace Mono.MonoBASIC {
                                        "declared as 'Protected'");
 
                        if ((Parent is Struct) && ((ModFlags & Modifiers.PROTECTED) != 0))
-                               Report.Error (30435, Location,
+                               Report.Error (31047, Location,
                                        "'Type' inside a 'Structure' can not be " +
                                        "declared as 'Protected'");
                        
@@ -1265,7 +1275,7 @@ namespace Mono.MonoBASIC {
                                                        continue;
                                                if ((p.ModFlags & static_mask) != static_flags)
                                                        continue;
-
+                                               
                                                MemberInfo pb = p.PropertyBuilder;
 
                                                if (pb != null && filter (pb, criteria) == true)
@@ -1556,7 +1566,7 @@ namespace Mono.MonoBASIC {
                {
                        const int vao = (Modifiers.VIRTUAL | Modifiers.ABSTRACT | Modifiers.OVERRIDE);
                        const int va = (Modifiers.VIRTUAL | Modifiers.ABSTRACT);
-                       const int nv = (Modifiers.SHADOWS | Modifiers.VIRTUAL);
+                       //const int nv = (Modifiers.SHADOWS | Modifiers.VIRTUAL);
                        bool ok = true;
                        string name = MakeName (n);
                        
@@ -1631,7 +1641,7 @@ namespace Mono.MonoBASIC {
                        if ((flags & Modifiers.PRIVATE) != 0){
                                if ((flags & vao) != 0){
                                        Report.Error (
-                                               31408, loc, name +
+                                               30266, loc, name +
                                                ": Members marked as Overridable or Overrides can not be Private");
                                        ok = false;
                                }
@@ -1670,7 +1680,7 @@ namespace Mono.MonoBASIC {
                // and return the new level.
                static AccessLevel CheckAccessLevel (AccessLevel level, int flags)
                {
-                       AccessLevel old_level = level;
+                       //AccessLevel old_level = level;
 
                        if ((flags & Modifiers.INTERNAL) != 0) {
                                if ((flags & Modifiers.PROTECTED) != 0) {
@@ -3321,7 +3331,7 @@ namespace Mono.MonoBASIC {
                                                      TypeManager.MonoBASIC_Name (MemberType) + "' is less " +
                                                      "accessible than property `" + Name + "'");
                                else if (this is Method)
-                                       Report.Error (50, Location,
+                                       Report.Error (30508, Location,
                                                      "Inconsistent accessibility: return type `" +
                                                      TypeManager.MonoBASIC_Name (MemberType) + "' is less " +
                                                      "accessible than method `" + Name + "'");
@@ -3499,7 +3509,7 @@ namespace Mono.MonoBASIC {
                        }
                        
                        if ((parent is Struct) && ((ModFlags & Modifiers.PROTECTED) != 0))
-                               Report.Error (30435, Location,
+                               Report.Error (31047, Location,
                                        "'Variable' inside a 'Structure' can not be " +
                                        "declared as 'Protected'");
 
@@ -3790,7 +3800,7 @@ namespace Mono.MonoBASIC {
                        if ((ModFlags & Modifiers.READONLY) != 0)
                                retval = MemberType;
 
-                       string report_name;
+                       //string report_name;
                        MethodSignature base_ms;
                        
                        /*
@@ -3803,7 +3813,7 @@ namespace Mono.MonoBASIC {
                                base_name = TypeManager.IndexerPropertyName (container.TypeBuilder.BaseType);
                                base_ms = new MethodSignature (base_name, retval, ParameterTypes);
                        } else */ {
-                               report_name = Name;
+                               //report_name = Name;
                                ms = base_ms = new MethodSignature (Name, retval, ParameterTypes);
                        }
 
@@ -3830,7 +3840,6 @@ namespace Mono.MonoBASIC {
                                MethodSignature.inheritable_property_signature_filter,
                                base_ms);
 
-
                        if (mi_instance.Count > 0)
                                mi = mi_instance;
                        else if (mi_static.Count > 0)
@@ -3960,9 +3969,9 @@ namespace Mono.MonoBASIC {
 
                public override bool Define (TypeContainer parent)
                {
-                       Type [] s_parameters=null;
+                       /*Type [] s_parameters=null;
                        Parameter [] s_parms;
-                       InternalParameters s_ip=null;
+                       InternalParameters s_ip=null;*/
                        
                        if ((parent is Struct) && ((ModFlags & Modifiers.PROTECTED) != 0))
                                Report.Error (30435, Location,
@@ -4248,7 +4257,7 @@ namespace Mono.MonoBASIC {
 
                public MethodBuilder Define (TypeContainer parent)
                {
-                       EventAttributes e_attr = EventAttributes.RTSpecialName | EventAttributes.SpecialName;
+                       //EventAttributes e_attr = EventAttributes.RTSpecialName | EventAttributes.SpecialName;
 
                        Type [] parameter_types = new Type [1];
                        parameter_types [0] = parent_event.MemberType;
@@ -4347,8 +4356,9 @@ namespace Mono.MonoBASIC {
 
                        Parameter [] parms = new Parameter [1];
                        parms [0] = new Parameter (Type, /* was "value" */ this.Name, Parameter.Modifier.NONE, null);
-                       InternalParameters ip = new InternalParameters (
+                       /*InternalParameters ip = new InternalParameters (
                                parent, new Parameters (parms, null, Location)); 
+                       */
 
                        if (!CheckBase (parent))
                                return false;