18 using System.Collections.Generic;
20 using ErrorManagement;
21 using TypeSystem.Operations;
23 namespace TypeSystem {
38 private Dictionary<string, AccessModifier> memberList =
new Dictionary<string, AccessModifier>();
43 protected Dictionary<string, AccessModifier>
fieldList =
new Dictionary<string, AccessModifier>();
53 private Dictionary<string, AccessModifier> methodList =
new Dictionary<string, AccessModifier>();
82 public Dictionary<string, AccessModifier>
Fields {
83 get {
return this.fieldList; }
90 get {
return this.constructorList; }
96 public Dictionary<string, AccessModifier>
Methods {
97 get {
return this.methodList; }
103 public Dictionary<string, AccessModifier>
Members {
104 get {
return this.memberList; }
106 this.memberList = value;
107 foreach (KeyValuePair<string, AccessModifier> pair
in value) {
111 else if (pair.Key.Equals(pair.Value.Class.Name)||pair.Key.Equals(pair.Value.Class.FullName))
112 if (this.constructorList != null)
113 System.Diagnostics.Debug.Assert(
false,
"Use intersection types for multiple constructors.");
114 else this.constructorList = pair.Value;
116 methodList[pair.Key] = pair.Value;
127 for (
int i = 0; i < value.Count; i++) {
128 this.modifierMask |= value[i];
131 value.Add(Modifier.Internal);
132 this.modifierMask |= Modifier.Internal;
134 this.modifierList = value;
142 get {
return this.name; }
150 get {
return this.modifierMask; }
158 get {
return this.interfaceList; }
170 this.fullName = identifier;
171 this.interfaceList =
new List<InterfaceType>();
190 memberList[
name] = accessModifier;
194 if (this.constructorList != null)
195 System.Diagnostics.Debug.Assert(
false,
"Use intersection types for multiple constructors.");
196 else this.constructorList = accessModifier;
198 methodList[
name] = accessModifier;
202 #region AddBaseClass()
213 #region AddBaseInterface()
222 this.interfaceList.Add((InterfaceType)inheritedType);
226 #region HasTypeVariables()
239 return this.hasTypeVariablesCache;
240 bool toReturn =
false;
247 evaluated.Add(am.Type.FullName);
249 if (am.
Type is FieldType)
250 result = ((FieldType)am.
Type).HasTypeVariables(evaluated);
252 result = am.Type.HasTypeVariables();
259 this.validHasTypeVariables =
true;
260 return this.hasTypeVariablesCache = toReturn;
264 #region InheritsFrom()
AccessModifier Constructors
Gets the constructor list
List< InterfaceType > interfaceList
Represents the identifiers of the interfaces
Dictionary< string, AccessModifier > Fields
Gets the field list
List< Modifier > modifierList
Stores the modifiers belong to the class type
bool validHasTypeVariables
To cache the result of the HasTypeVariables method
This class encapsulates a location in a specific file. Implements an Inmutable pattern. So it can be used in any context, that is his internal fields never change.
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
string Name
Class identifier;
UserType(string identifier)
Constructor of UserType
Dictionary< string, AccessModifier > Methods
Gets the method list
override object AcceptOperation(TypeSystemOperation op, object arg)
Represents a interface type.
void AddMember(string name, AccessModifier accessModifier)
Use allways this method to add any attribute. It takes into account if that attribute is a constructo...
Modifier modifierMask
Stores a mask with the modifier information
override bool HasTypeVariables()
To know if the type expression has some type variables and requieres unification The default implemen...
Abstract class that represents all different types.
virtual bool InheritsFrom(UserType superType)
Tells if the implicit object is a subtype of the superType
List< Modifier > Modifiers
Gets and sets the attribute modifiers
virtual string FullName
Gets the full name of the type Note: WriteType expression is the longest recursive representation of ...
No location information is provided within this class, because the exec methods invoked by the proper...
bool HasTypeVariables(IList< String > evaluated)
abstract void AddBaseClass(ClassType inheritedType, Location location)
Adds a new inherited class
Dictionary< string, AccessModifier > fieldList
Represents all class fields.
string name
Class identifier;
Dictionary< string, AccessModifier > Members
Gets and sets the attribute list
List< InterfaceType > InterfaceList
Gets the list of interfaces
Modifier
Indicates differents modifiers to use in class (only public, internal or static), fields or methods...
UserType Class
Gets or sets the class type reference
Representa a method type.
override object AcceptOperation(TypeSystemOperation op, object arg)
Association Class between ClassType and MethodType (or Fields). Represents the access modifier inform...
void AddBaseInterface(InterfaceType inheritedType, Location location)
Adds a new inherited interface
TypeExpression Type
Gets or sets the attribute type expression
Represents a class or interface type.
Modifier ModifierMask
Gets the modifier information