2002-11-19 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Wed, 20 Nov 2002 01:53:45 +0000 (01:53 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Wed, 20 Nov 2002 01:53:45 +0000 (01:53 -0000)
* ecore.cs (SimpleName.SimpleNameResolve): Remove the special
handling for enumerations, as we only needed the TypeContainer
functionality to begin with (this is required for the fix below to
work for enums that reference constants in a container class for
example).

* codegen.cs (EmitContext): Make TypeContainer a DeclSpace.

* enum.cs (Enum.Define): Use `this' instead of parent, so we have
a valid TypeBuilder to perform lookups on.o

* class.cs (InheritableMemberSignatureCompare): Use true in the
call to GetGetMethod and GetSetMethod, because we are comparing
the signature, and we need to get the methods *even* if they are
private.

(PropertyBase.CheckBase): ditto.

svn path=/trunk/mcs/; revision=9102

mcs/mcs/ChangeLog
mcs/mcs/class.cs
mcs/mcs/codegen.cs
mcs/mcs/ecore.cs
mcs/mcs/enum.cs

index 4faa49297e4a3494acd7b19863ac731078695d37..5d550d113aa921e93bbddea4ee340d56fdaa127d 100755 (executable)
@@ -1,5 +1,23 @@
 2002-11-19  Miguel de Icaza  <miguel@ximian.com>
 
+       * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
+       handling for enumerations, as we only needed the TypeContainer
+       functionality to begin with (this is required for the fix below to
+       work for enums that reference constants in a container class for
+       example). 
+
+       * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
+
+       * enum.cs (Enum.Define): Use `this' instead of parent, so we have
+       a valid TypeBuilder to perform lookups on.o
+
+       * class.cs (InheritableMemberSignatureCompare): Use true in the
+       call to GetGetMethod and GetSetMethod, because we are comparing
+       the signature, and we need to get the methods *even* if they are
+       private. 
+
+       (PropertyBase.CheckBase): ditto.
+
        * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
        GotoCase.Resolve): Use Peel on EmpytCasts.
 
index 50d840a7e46e2ab421bc6700664dc18f9648e37c..12dd228cd98dd1ec2e52e70ac1f8e4e71a10d455 100755 (executable)
@@ -3601,8 +3601,8 @@ namespace Mono.CSharp {
                                        parent_property.Name;
 
                                MethodInfo get, set, parent_method;
-                               get = parent_property.GetGetMethod ();
-                               set = parent_property.GetSetMethod ();
+                               get = parent_property.GetGetMethod (true);
+                               set = parent_property.GetSetMethod (true);
 
                                if (get != null)
                                        parent_method = get;
@@ -4705,12 +4705,16 @@ namespace Mono.CSharp {
                        PropertyInfo pi = m as PropertyInfo;
 
                        if (pi != null) {
-                               mi = pi.GetGetMethod ();
+                               mi = pi.GetGetMethod (true);
                                if (mi == null)
-                                       mi = pi.GetSetMethod ();
+                                       mi = pi.GetSetMethod (true);
                        } else
                                mi = m as MethodInfo;
 
+                       if (mi == null){
+                               Console.WriteLine ("Nothing found");
+                       }
+                       
                        MethodAttributes prot = mi.Attributes & MethodAttributes.MemberAccessMask;
 
                        // If only accessible to the current class.
index 44afcb2c5e26e699905827073f83a3ab3fbc418e..f22dd3465bff1c21ac4ba86e7ccf6336e0a54ba7 100755 (executable)
@@ -211,7 +211,7 @@ namespace Mono.CSharp {
        /// </summary>
        public class EmitContext {
                public DeclSpace DeclSpace;
-               public TypeContainer TypeContainer;
+               public DeclSpace TypeContainer;
                public ILGenerator   ig;
 
                /// <summary>
@@ -335,7 +335,7 @@ namespace Mono.CSharp {
 
                protected Stack FlowStack;
                
-               public EmitContext (TypeContainer parent, DeclSpace ds, Location l, ILGenerator ig,
+               public EmitContext (DeclSpace parent, DeclSpace ds, Location l, ILGenerator ig,
                                    Type return_type, int code_flags, bool is_constructor)
                {
                        this.ig = ig;
index dab630d3f170e8fe761a923e28cea519e34f81c8..e4d3a448bc56f18af35fc62f38adb313bfa0fe6b 100755 (executable)
@@ -3545,11 +3545,6 @@ namespace Mono.CSharp {
                        // Stage 2: Lookup members 
                        //
 
-                       //
-                       // For enums, the TypeBuilder is not ec.DeclSpace.TypeBuilder
-                       // Hence we have two different cases
-                       //
-
                        DeclSpace lookup_ds = ec.DeclSpace;
                        do {
                                if (lookup_ds.TypeBuilder == null)
@@ -3559,13 +3554,7 @@ namespace Mono.CSharp {
                                if (e != null)
                                        break;
 
-                               //
-                               // Classes/structs keep looking, enums break
-                               //
-                               if (lookup_ds is TypeContainer)
-                                       lookup_ds = ((TypeContainer) lookup_ds).Parent;
-                               else
-                                       break;
+                               lookup_ds =lookup_ds.Parent;
                        } while (lookup_ds != null);
                                
                        if (e == null && ec.ContainerType != null)
index 691fcbe6b1291424181587d730f6e8bcda8301a1..c30ac699e1a5ce28cad35ab95ad4cfc431c2192a 100755 (executable)
@@ -512,8 +512,9 @@ namespace Mono.CSharp {
                        if (TypeBuilder == null)
                                return false;
                        
-                       EmitContext ec = new EmitContext (parent, this, Location, null,
+                       EmitContext ec = new EmitContext (this, this, Location, null,
                                                          UnderlyingType, ModFlags, false);
+
                        
                        object default_value = 0;