21 using System.Collections.Generic;
25 using ErrorManagement;
27 using TypeSystem.Operations;
29 namespace TypeSystem {
53 private IDictionary<TypeVariable, TypeVariable> typeVariableMappings;
58 private IList<EquivalenceClass> equivalenceClasses;
78 public ClassTypeProxy(
ClassType originalClass, IDictionary<TypeVariable, TypeVariable> typeVariableMappings, IList<EquivalenceClass> equivalenceClasses) {
85 this.originalClass = originalClass;
86 this.typeVariableMappings = typeVariableMappings;
87 this.equivalenceClasses = equivalenceClasses;
88 this.fullName = originalClass.FullName;
93 private void unfold() {
98 if (this.realType == null) {
99 this.realType = (
ClassType)this.originalClass.
CloneTypeVariables(
this.typeVariableMappings,
this.equivalenceClasses,
new List<ClassType>());
106 equivalenceClass.UpdateEquivalenceClass(typeVariableMappings);
108 this.realType.ValidTypeExpression =
false;
114 #region BuildTypeExpressionString()
120 if (this.realType.ValidTypeExpression)
121 return this.realType.typeExpression;
122 return this.realType.FullName;
132 #region Assignment() ANULADA
152 #region Dot() ANULADA
181 #region Parenthesis() ANULADA
200 #region AsClassType() ANULADA
207 return this.originalClass;
211 #region Equivalent() ANULADA
224 #region PromotionLevel() ANULADA
235 #region Promotion() ANULADA
254 #region EqualsForOverload() ANULADA
276 return this.RealType.Unify(te, unification, previouslyUnified);
281 #region HasTypeVariables()
288 return this.RealType.HasTypeVariables();
293 return this.RealType.HasTypeVariables(evaluated);
308 return this.RealType.CloneType(typeVariableMappings);
313 #region CloneTypeVariables()
314 public override TypeExpression CloneTypeVariables(IDictionary<TypeVariable, TypeVariable> typeVariableMappings, IList<EquivalenceClass> equivalenceClasses, IList<ClassType> clonedClasses) {
325 return this.RealType.CloneTypeVariables(typeVariableMappings, equivalenceClasses, clonedClasses);
332 internal override TypeExpression Clone(IDictionary<int, TypeVariable> clonedTypeVariables, IList<EquivalenceClass> equivalenceClasses, MethodType methodAnalyzed) {
346 if (newClassProxy.realType != null)
347 newClassProxy.realType = (ClassType)newClassProxy.realType.Clone(clonedTypeVariables, equivalenceClasses, methodAnalyzed);
348 return newClassProxy;
354 #region Equals&GetHashCode()
355 public override bool Equals(
object obj) {
359 return this.RealType.Equals(obj);
362 return this.FullName.GetHashCode();
366 #region IsValueType()
374 return this.realType.IsValueType();
ClassType RealType
The real subject of the proxy (see the Proxy design pattern)
override ClassType AsClassType()
Check if the type can make an assignment operation.
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
override TypeExpression CloneTypeVariables(IDictionary< TypeVariable, TypeVariable > typeVariableMappings, IList< EquivalenceClass > equivalenceClasses, IList< ClassType > clonedClasses)
Method that clones each type variable of a type expression. Equivalence classes are not cloned (but i...
Abstract class that represents all different types.
override bool HasTypeVariables()
To know if the type expression has some type variables and requieres unification The default implemen...
Represents a proxy of a class type. It implements the unfold operatations of theoretical type systes...
override object AcceptOperation(TypeSystemOperation op, object arg)
override string BuildTypeExpressionString(int depthLevel)
Creates the type expression string.
override TypeExpression CloneTypeVariables(IDictionary< TypeVariable, TypeVariable > typeVariableMappings, IList< EquivalenceClass > equivalenceClasses, IList< ClassType > clonedClasses)
Method that clones each type variable of a type expression. Equivalence classes are not cloned (but i...
override bool Equals(object obj)
To check loops in recursive types, proxy must be equal that the classes they represent ...
ClassTypeProxy(ClassType originalClass, IDictionary< TypeVariable, TypeVariable > typeVariableMappings, IList< EquivalenceClass > equivalenceClasses)
Constructor of the ClassType Proxy
override bool Unify(TypeExpression te, SortOfUnification unification, IList< Pair< TypeExpression, TypeExpression >> previouslyUnified)
Used to not repeat methods in overload
override bool IsValueType()
True if type expression is a ValueType. Otherwise, false.
bool HasTypeVariables(IList< String > evaluated)
override int GetHashCode()
override TypeExpression CloneType(IDictionary< TypeVariable, TypeVariable > typeVariableMappings)
This method creates a new class type, creating new type variables for each field. Methods are not clo...