2003-04-17 Miguel de Icaza <miguel@ximian.com>
[mono.git] / mcs / mcs / interface.cs
index 1d2dc2f5ccaa2ba089fa7d8fc57f6404706ae31d..f47a91c35f8d9f6c860ba1cea92ac17fc38baee5 100755 (executable)
@@ -300,7 +300,10 @@ namespace Mono.CSharp {
                //
                void PopulateMethod (TypeContainer parent, DeclSpace decl_space, InterfaceMethod im)
                {
-                       Type return_type = this.ResolveType (im.ReturnType, false, im.Location);
+                       Type return_type = im.ReturnType.Type;
+                       if (return_type == null)
+                               return_type = this.ResolveType (im.ReturnType, false, im.Location);
+                       
                        Type [] arg_types = im.ParameterTypes (this);
                        MethodBuilder mb;
                        Parameter [] p;
@@ -332,7 +335,7 @@ namespace Mono.CSharp {
                                return_type, arg_types);
 
                        InternalParameters ip = new InternalParameters (arg_types, im.Parameters);
-                       
+
                        if (!RegisterMethod (mb, ip, arg_types)) {
                                Error111 (im);
                                return;
@@ -355,7 +358,7 @@ namespace Mono.CSharp {
                                                          return_type, ModFlags, false);
 
                        if (im.OptAttributes != null)
-                               Attribute.ApplyAttributes (ec, mb, im, im.OptAttributes, Location);
+                               Attribute.ApplyAttributes (ec, mb, im, im.OptAttributes);
                }
 
                //
@@ -366,6 +369,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];
 
@@ -433,7 +439,7 @@ namespace Mono.CSharp {
                                                          null, ModFlags, false);
 
                        if (ip.OptAttributes != null)
-                               Attribute.ApplyAttributes (ec, pb, ip, ip.OptAttributes, Location);
+                               Attribute.ApplyAttributes (ec, pb, ip, ip.OptAttributes);
 
                        TypeManager.RegisterProperty (pb, get, set);
                        property_builders.Add (pb);
@@ -451,6 +457,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)
@@ -462,7 +471,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);
 
                        //
@@ -501,7 +510,7 @@ namespace Mono.CSharp {
 
 
                        if (ie.OptAttributes != null)
-                               Attribute.ApplyAttributes (ec, eb, ie, ie.OptAttributes, Location);
+                               Attribute.ApplyAttributes (ec, eb, ie, ie.OptAttributes);
 
                        TypeManager.RegisterEvent (eb, add, remove);
                        event_builders.Add (eb);
@@ -514,6 +523,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;
@@ -618,7 +630,7 @@ namespace Mono.CSharp {
                        }
 
                        if (ii.OptAttributes != null)
-                               Attribute.ApplyAttributes (ec, pb, ii, ii.OptAttributes, Location);
+                               Attribute.ApplyAttributes (ec, pb, ii, ii.OptAttributes);
 
                        property_builders.Add (pb);
                }
@@ -818,9 +830,13 @@ namespace Mono.CSharp {
                /// </summary>
                public override bool DefineMembers (TypeContainer parent)
                {
+                       if (members_defined)
+                               return true;
+                       
                        if (!SemanticAnalysis ())
                                return false;
 
+                       
                        if (defined_method != null){
                                foreach (InterfaceMethod im in defined_method)
                                        PopulateMethod (parent, this, im);
@@ -862,7 +878,7 @@ namespace Mono.CSharp {
                        if (OptAttributes != null) {
                                EmitContext ec = new EmitContext (parent, this, Location, null, null,
                                                                  ModFlags, false);
-                               Attribute.ApplyAttributes (ec, TypeBuilder, this, OptAttributes, Location);
+                               Attribute.ApplyAttributes (ec, TypeBuilder, this, OptAttributes);
                        }
 
                        return true;
@@ -1003,7 +1019,7 @@ namespace Mono.CSharp {
        }
        
        public class InterfaceMethod : InterfaceMemberBase {
-               public readonly Expression ReturnType;
+               public Expression ReturnType;
                public readonly Parameters Parameters;
                public readonly Location Location;
                
@@ -1021,7 +1037,11 @@ namespace Mono.CSharp {
                /// </summary>
                public string GetSignature (DeclSpace ds)
                {
-                       Type ret = ds.ResolveType (ReturnType, false, Location);
+                       ReturnType = ds.ResolveTypeExpr (ReturnType, false, Location);
+                       if (ReturnType == null)
+                               return null;
+                       
+                       Type ret = ReturnType.Type;
                        string args = Parameters.GetSignature (ds);
 
                        if ((ret == null) || (args == null))