X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Finterface.cs;h=2c5b939f41e93f6902ef39ac9182bc7e6281993e;hb=f282c09a4f474c0994bf739e0b300043fd342b80;hp=61636f399945348c02b3fce36e8e09f10a18e588;hpb=aa5d984a6de002308b300608f3f3a65a48c5e8ab;p=mono.git diff --git a/mcs/mcs/interface.cs b/mcs/mcs/interface.cs index 61636f39994..2c5b939f41e 100755 --- a/mcs/mcs/interface.cs +++ b/mcs/mcs/interface.cs @@ -53,6 +53,8 @@ namespace Mono.CSharp { IMemberContainer parent_container; MemberCache member_cache; + bool members_defined; + // These will happen after the semantic analysis // Hashtable defined_indexers; @@ -228,9 +230,22 @@ namespace Mono.CSharp { return true; } - public MethodInfo [] GetMethods () + // + // This might trigger a definition of the methods. This happens only + // with Attributes, as Attribute classes are processed before interfaces. + // Ideally, we should make everything just define recursively in terms + // of its dependencies. + // + public MethodInfo [] GetMethods (TypeContainer container) { - int n = method_builders.Count; + int n = 0; + + if (!members_defined){ + if (DefineMembers (container)) + n = method_builders.Count; + } else + n = method_builders.Count; + MethodInfo [] mi = new MethodInfo [n]; method_builders.CopyTo (mi, 0); @@ -351,6 +366,9 @@ namespace Mono.CSharp { PropertyBuilder pb; MethodBuilder get = null, set = null; ip.Type = this.ResolveTypeExpr (ip.Type, false, ip.Location); + if (ip.Type == null) + return; + Type prop_type = ip.Type.Type; Type [] setter_args = new Type [1]; @@ -436,6 +454,9 @@ namespace Mono.CSharp { MyEventBuilder eb; MethodBuilder add = null, remove = null; ie.Type = this.ResolveTypeExpr (ie.Type, false, ie.Location); + if (ie.Type == null) + return; + Type event_type = ie.Type.Type; if (event_type == null) @@ -447,7 +468,7 @@ namespace Mono.CSharp { Type [] parameters = new Type [1]; parameters [0] = event_type; - eb = new MyEventBuilder (TypeBuilder, ie.Name, + eb = new MyEventBuilder (null, TypeBuilder, ie.Name, EventAttributes.None, event_type); // @@ -499,6 +520,9 @@ namespace Mono.CSharp { { PropertyBuilder pb; ii.Type = this.ResolveTypeExpr (ii.Type, false, ii.Location); + if (ii.Type == null) + return; + Type prop_type = ii.Type.Type; Type [] arg_types = ii.ParameterTypes (this); Type [] value_arg_types; @@ -642,7 +666,7 @@ namespace Mono.CSharp { Type GetInterfaceTypeByName (string name) { - Type t = FindType (name); + Type t = FindType (Location, name); if (t == null) { Report.Error (246, Location, "The type or namespace `" + name + @@ -835,7 +859,7 @@ namespace Mono.CSharp { member_cache = new MemberCache (this); #endif - + members_defined = true; return true; }