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)
14 /*This file will go off shortly
15 * after copying the interface class
19 using System.Collections;
22 using System.Reflection;
23 using System.Reflection.Emit;
25 namespace Mono.MonoBASIC {
35 public class Interface : Mono.MonoBASIC.Class /*TypeContainer , IMemberContainer */
38 /// Modifiers allowed in a class declaration
40 public new const int AllowedModifiers =
47 public Interface (TypeContainer parent, string name, int mod,
48 Attributes attrs, Location l)
49 : base (parent, name, 0, attrs, l)
53 if (parent.Parent == null)
54 accmods = Modifiers.INTERNAL;
56 accmods = Modifiers.PUBLIC;
58 this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
59 this.ModFlags |= Modifiers.ABSTRACT;
62 public override AttributeTargets AttributeTargets {
64 return AttributeTargets.Interface;
68 public override TypeAttributes TypeAttr
72 return base.TypeAttr |
73 TypeAttributes.AutoLayout |
74 TypeAttributes.Abstract |
75 TypeAttributes.Interface;
81 public class InterfaceMemberBase {
82 public readonly string Name;
83 public readonly bool IsNew;
84 public Attributes OptAttributes;
86 public InterfaceMemberBase (string name, bool is_new, Attributes attrs)
90 OptAttributes = attrs;
94 public class InterfaceProperty : InterfaceMemberBase {
95 public readonly bool HasSet;
96 public readonly bool HasGet;
97 public readonly Location Location;
98 public Expression Type;
100 public InterfaceProperty (Expression type, string name,
101 bool is_new, bool has_get, bool has_set,
102 Attributes attrs, Location loc)
103 : base (name, is_new, attrs)
112 /* public class InterfaceEvent : InterfaceMemberBase {
113 public readonly Location Location;
114 public Expression Type;
116 public InterfaceEvent (Expression type, string name, bool is_new, Attributes attrs,
118 : base (name, is_new, attrs)
125 public class InterfaceMethod : InterfaceMemberBase {
126 public readonly Expression ReturnType;
127 public readonly Parameters Parameters;
128 public readonly Location Location;
130 public InterfaceMethod (Expression return_type, string name, bool is_new, Parameters args,
131 Attributes attrs, Location l)
132 : base (name, is_new, attrs)
134 this.ReturnType = return_type;
135 this.Parameters = args;
140 /// Returns the signature for this interface method
142 public string GetSignature (DeclSpace ds)
144 Type ret = ds.ResolveType (ReturnType, false, Location);
145 string args = Parameters.GetSignature (ds);
147 if ((ret == null) || (args == null))
150 return (IsNew ? "new-" : "") + ret.FullName + "(" + args + ")";
153 public Type [] ParameterTypes (DeclSpace ds)
155 return Parameters.GetParameterInfo (ds);
159 public class InterfaceIndexer : InterfaceMemberBase {
160 public readonly bool HasGet, HasSet;
161 public readonly Parameters Parameters;
162 public readonly Location Location;
163 public Expression Type;
165 public InterfaceIndexer (Expression type, Parameters args, bool do_get, bool do_set,
166 bool is_new, Attributes attrs, Location loc)
167 : base ("", is_new, attrs)
176 public Type [] ParameterTypes (DeclSpace ds)
178 return Parameters.GetParameterInfo (ds);