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 */
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, attrs
, 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
;
61 public override AttributeTargets AttributeTargets
{
63 return AttributeTargets
.Interface
;
67 public override TypeAttributes TypeAttr
71 return base.TypeAttr
|
72 TypeAttributes
.AutoLayout
|
73 TypeAttributes
.Abstract
|
74 TypeAttributes
.Interface
;
80 public class InterfaceMemberBase {
81 public readonly string Name;
82 public readonly bool IsNew;
83 public Attributes OptAttributes;
85 public InterfaceMemberBase (string name, bool is_new, Attributes attrs)
89 OptAttributes = attrs;
93 public class InterfaceProperty : InterfaceMemberBase {
94 public readonly bool HasSet;
95 public readonly bool HasGet;
96 public readonly Location Location;
97 public Expression Type;
99 public InterfaceProperty (Expression type, string name,
100 bool is_new, bool has_get, bool has_set,
101 Attributes attrs, Location loc)
102 : base (name, is_new, attrs)
111 /* public class InterfaceEvent : InterfaceMemberBase {
112 public readonly Location Location;
113 public Expression Type;
115 public InterfaceEvent (Expression type, string name, bool is_new, Attributes attrs,
117 : base (name, is_new, attrs)
124 public class InterfaceMethod : InterfaceMemberBase {
125 public readonly Expression ReturnType;
126 public readonly Parameters Parameters;
127 public readonly Location Location;
129 public InterfaceMethod (Expression return_type, string name, bool is_new, Parameters args,
130 Attributes attrs, Location l)
131 : base (name, is_new, attrs)
133 this.ReturnType = return_type;
134 this.Parameters = args;
139 /// Returns the signature for this interface method
141 public string GetSignature (DeclSpace ds)
143 Type ret = ds.ResolveType (ReturnType, false, Location);
144 string args = Parameters.GetSignature (ds);
146 if ((ret == null) || (args == null))
149 return (IsNew ? "new-" : "") + ret.FullName + "(" + args + ")";
152 public Type [] ParameterTypes (DeclSpace ds)
154 return Parameters.GetParameterInfo (ds);
158 public class InterfaceIndexer : InterfaceMemberBase {
159 public readonly bool HasGet, HasSet;
160 public readonly Parameters Parameters;
161 public readonly Location Location;
162 public Expression Type;
164 public InterfaceIndexer (Expression type, Parameters args, bool do_get, bool do_set,
165 bool is_new, Attributes attrs, Location loc)
166 : base ("", is_new, attrs)
175 public Type [] ParameterTypes (DeclSpace ds)
177 return Parameters.GetParameterInfo (ds);