2 // Copyright (c) 2004, Rodrigo B. de Oliveira (rbo@acm.org)
3 // All rights reserved.
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 // * Neither the name of Rodrigo B. de Oliveira nor the names of its
14 // contributors may be used to endorse or promote products derived from this
15 // software without specific prior written permission.
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
21 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 namespace Boo
.Lang
.Compiler
.TypeSystem
31 public abstract class AbstractType
: IType
, INamespace
33 public abstract string Name
38 public abstract EntityType EntityType
43 public virtual string FullName
51 public virtual IType Type
59 public virtual bool IsByRef
67 public virtual bool IsClass
75 public virtual bool IsAbstract
83 public virtual bool IsInterface
91 public virtual bool IsFinal
99 public virtual bool IsEnum
107 public virtual bool IsValueType
115 public virtual bool IsArray
123 public virtual IType BaseType
131 public virtual IType
GetElementType()
136 public virtual IEntity
GetDefaultMember()
141 public virtual int GetTypeDepth()
146 public virtual bool IsSubclassOf(IType other
)
151 public virtual bool IsAssignableFrom(IType other
)
156 public virtual IConstructor
[] GetConstructors()
158 return new IConstructor
[0];
161 public virtual IType
[] GetInterfaces()
166 public virtual IEntity
[] GetMembers()
168 return new IEntity
[0];
171 public virtual INamespace ParentNamespace
179 public virtual bool Resolve(Boo
.Lang
.List targetList
, string name
, EntityType flags
)
184 override public string ToString()
189 IGenericTypeInfo IType
.GenericInfo
194 IConstructedTypeInfo IType
.ConstructedInfo
200 public class Null
: AbstractType
202 public static Null Default
= new Null();
208 override public string Name
216 override public EntityType EntityType
220 return EntityType
.Null
;
225 public class Unknown
: AbstractType
227 public static Unknown Default
= new Unknown();
233 override public string Name
241 override public EntityType EntityType
245 return EntityType
.Unknown
;
250 public class Error
: AbstractType
252 public static Error Default
= new Error();
258 override public string Name
266 override public EntityType EntityType
270 return EntityType
.Error
;