2 // interface.cs: Interface handler
4 // Author: Miguel de Icaza (miguel@gnu.org)
5 // Anirban Bhattacharjee (banirban@novell.com)
7 // Licensed under the terms of the GNU GPL
9 // (C) 2001 Ximian, Inc (http://www.ximian.com)
12 /*This file will go off shortly
13 * after copying the interface class
18 using System.Collections;
21 using System.Reflection;
22 using System.Reflection.Emit;
24 namespace Mono.MonoBASIC {
34 public class Interface : Mono.MonoBASIC.Class /*TypeContainer , IMemberContainer */
\r
37 /// Modifiers allowed in a class declaration
39 public new const int AllowedModifiers =
46 public Interface (TypeContainer parent, string name, int mod,
47 Attributes attrs, Location l)
48 : base (parent, name, 0, null, l)
52 if (parent.Parent == null)
53 accmods = Modifiers.INTERNAL;
55 accmods = Modifiers.PUBLIC;
57 this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
58 this.ModFlags |= Modifiers.ABSTRACT;
59 this.attributes = attrs;
62 /*public override AttributeTargets AttributeTargets
\r
66 return AttributeTargets.Interface;
70 public override TypeAttributes TypeAttr
\r
74 return base.TypeAttr |
75 TypeAttributes.AutoLayout |
76 TypeAttributes.Abstract |
77 TypeAttributes.Interface;
83 public class InterfaceMemberBase {
84 public readonly string Name;
85 public readonly bool IsNew;
86 public Attributes OptAttributes;
88 public InterfaceMemberBase (string name, bool is_new, Attributes attrs)
92 OptAttributes = attrs;
96 public class InterfaceProperty : InterfaceMemberBase {
97 public readonly bool HasSet;
98 public readonly bool HasGet;
99 public readonly Location Location;
100 public Expression Type;
102 public InterfaceProperty (Expression type, string name,
103 bool is_new, bool has_get, bool has_set,
104 Attributes attrs, Location loc)
105 : base (name, is_new, attrs)
114 /* public class InterfaceEvent : InterfaceMemberBase {
115 public readonly Location Location;
116 public Expression Type;
118 public InterfaceEvent (Expression type, string name, bool is_new, Attributes attrs,
120 : base (name, is_new, attrs)
127 public class InterfaceMethod : InterfaceMemberBase {
128 public readonly Expression ReturnType;
129 public readonly Parameters Parameters;
130 public readonly Location Location;
132 public InterfaceMethod (Expression return_type, string name, bool is_new, Parameters args,
133 Attributes attrs, Location l)
134 : base (name, is_new, attrs)
136 this.ReturnType = return_type;
137 this.Parameters = args;
142 /// Returns the signature for this interface method
144 public string GetSignature (DeclSpace ds)
146 Type ret = ds.ResolveType (ReturnType, false, Location);
147 string args = Parameters.GetSignature (ds);
149 if ((ret == null) || (args == null))
152 return (IsNew ? "new-" : "") + ret.FullName + "(" + args + ")";
155 public Type [] ParameterTypes (DeclSpace ds)
157 return Parameters.GetParameterInfo (ds);
161 public class InterfaceIndexer : InterfaceMemberBase {
162 public readonly bool HasGet, HasSet;
163 public readonly Parameters Parameters;
164 public readonly Location Location;
165 public Expression Type;
167 public InterfaceIndexer (Expression type, Parameters args, bool do_get, bool do_set,
168 bool is_new, Attributes attrs, Location loc)
169 : base ("", is_new, attrs)
178 public Type [] ParameterTypes (DeclSpace ds)
180 return Parameters.GetParameterInfo (ds);