19 using System.Collections.Generic;
22 using ErrorManagement;
25 using TypeSystem.Operations;
27 namespace TypeSystem {
48 this.name = identifier;
49 this.Modifiers = modifiers;
59 this.Modifiers =
new List<Modifier>();
63 #region AddBaseClass()
72 System.Diagnostics.Debug.Assert(
false,
"A base class cannot be added to an interface.");
76 #region BuiltTypeExpression()
82 if (this.ValidTypeExpression)
return this.typeExpression;
83 if (depthLevel <= 0)
return this.FullName;
87 tE.AppendFormat(
"Interface({0},", this.fullName);
90 for (
int i = 0; i < this.modifierList.Count - 1; i++) {
91 tE.AppendFormat(
" {0} x", this.modifierList[i]);
93 tE.AppendFormat(
" {0}", this.modifierList[this.modifierList.Count - 1]);
99 for (
int i = 0; i < this.interfaceList.Count - 1; i++) {
100 tE.AppendFormat(
" {0} x", this.interfaceList[i].FullName);
102 tE.AppendFormat(
" {0}", this.interfaceList[this.interfaceList.Count - 1].FullName);
108 Dictionary<string, AccessModifier>.KeyCollection keys = this.Members.Keys;
110 foreach (
string key
in keys) {
111 tE.Append(this.Members[key].Type.BuildTypeExpressionString(depthLevel - 1));
112 if (i < keys.Count - 1)
118 this.ValidTypeExpression =
true;
119 return this.typeExpression = tE.ToString();
129 #region Dot() ANULADA
173 #region Assignment = ... ANULADA
198 #region PromotionLevel() ANULADA
267 aux.AppendFormat(
"class {0}", this.fullName);
268 return aux.ToString();
300 this.ValidTypeExpression =
false;
301 te.ValidTypeExpression =
false;
306 return te.Unify(
this, unification, previouslyUnified);
311 #region IsValueType()
List< InterfaceType > interfaceList
Represents the identifiers of the interfaces
List< Modifier > modifierList
Stores the modifiers belong to the class type
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...
override string ILType()
Check if the type can make an assignment operation.
Represents a interface type.
override bool Unify(TypeExpression te, SortOfUnification unification, IList< Pair< TypeExpression, TypeExpression >> previouslyUnified)
This method unifies two type expressions (this and te)
Abstract class that represents all different types.
System.Text.StringBuilder StringBuilder
No location information is provided within this class, because the exec methods invoked by the proper...
string name
Class identifier;
Dictionary< string, AccessModifier > Members
Gets and sets the attribute list
override bool IsValueType()
True if type expression is a ValueType. Otherwise, false.
override void AddBaseClass(ClassType inheritedClass, Location location)
Adds a new inherited type
string fullName
Represents the full name of the type Note: WriteType expression is the longest recursive representati...
InterfaceType(string identifier, string fullName, List< Modifier > modifiers)
Constructor of InterfaceType
override object AcceptOperation(TypeSystemOperation op, object arg)
override string BuildTypeExpressionString(int depthLevel)
Creates the type expression string.
InterfaceType(string name)
Constructor of InterfaceType
Represents a class or interface type.