2010-06-02 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / mcs / method.cs
index 2932ae27837bc9a3c08adf772539b8eb3e1ba96f..2b92e4260b3140c4d1add641f97c5f5b42cd1ef1 100644 (file)
@@ -980,7 +980,9 @@ namespace Mono.CSharp {
                                        tp.Type.TypeArguments = base_tparam.TypeArguments;
 
                                        // TODO MemberCache: Inflate with different MVAR ?
-                                       tp.Type.Interfaces = base_tparam.Interfaces;
+                                       if (base_tparam.InterfacesDefined != null)
+                                               tp.Type.Interfaces = new List<TypeSpec> (base_tparam.InterfacesDefined);
+
                                        tp.Type.BaseType = base_tparam.BaseType;
                                } else if (MethodData.implementing != null) {
                                        var base_tp = MethodData.implementing.Constraints[i];
@@ -1814,13 +1816,24 @@ namespace Mono.CSharp {
                                        if ((modifiers & Modifiers.OVERRIDE) == 0)
                                                flags |= MethodAttributes.NewSlot;
                                }
-                               flags |=
-                                       MethodAttributes.Virtual |
-                                       MethodAttributes.HideBySig;
+
+                               flags |= MethodAttributes.Virtual | MethodAttributes.HideBySig;
 
                                // Set Final unless we're virtual, abstract or already overriding a method.
                                if ((modifiers & (Modifiers.VIRTUAL | Modifiers.ABSTRACT | Modifiers.OVERRIDE)) == 0)
                                        flags |= MethodAttributes.Final;
+
+                               //
+                               // clear the pending implementation flag (requires explicit methods to be defined first)
+                               //
+                               parent.PartialContainer.PendingImplementations.ImplementMethod (method.MethodName,
+                                       member.InterfaceType, this, member.IsExplicitImpl);
+
+                               //
+                               // Update indexer accessor name to match implementing abstract accessor
+                               //
+                               if (!implementing.DeclaringType.IsInterface && !member.IsExplicitImpl && implementing.IsAccessor)
+                                       method_full_name = implementing.MemberDefinition.Name;
                        }
 
                        DefineMethodBuilder (container, method_full_name, method.ParameterInfo);
@@ -1883,13 +1896,6 @@ namespace Mono.CSharp {
 
                        method.ParameterInfo.ApplyAttributes (MethodBuilder);
 
-                       //
-                       // clear the pending implementation flag
-                       //
-                       if (implementing != null)
-                               parent.PartialContainer.PendingImplementations.ImplementMethod (method.MethodName,
-                                       member.InterfaceType, this, member.IsExplicitImpl);
-
                        SourceMethod source = SourceMethod.Create (parent, MethodBuilder, method.Block);
 
                        ToplevelBlock block = method.Block;
@@ -1943,8 +1949,7 @@ namespace Mono.CSharp {
 
                protected override bool CheckBase ()
                {
-                       if (!base.CheckBase ())
-                               return false;
+                       // Don't check base, the destructor has special syntax
 
                        var base_type = Parent.PartialContainer.BaseType;
                        if (base_type == null)
@@ -1955,7 +1960,7 @@ namespace Mono.CSharp {
                                if (method_expr == null)
                                        throw new NotImplementedException ();
 
-                               method_expr.IsBase = true;
+                               method_expr.QueriedBaseType = base_type;
                                method_expr.InstanceExpression = new CompilerGeneratedThis (Parent.Definition, Location);
 
                                ToplevelBlock new_block = new ToplevelBlock (Compiler, Block.StartLocation);