// Loop detection #region Equals&GetHashCode() /// <summary> /// To check loops in recursive types, proxy must be equal that the classes they represent /// </summary> public override bool Equals(object obj) { ClassType parameter = obj as ClassType; if (parameter == null) { ClassTypeProxy proxy = obj as ClassTypeProxy; if (proxy == null) { return(false); } parameter = proxy.RealType; } if (!this.FullName.Equals(parameter.FullName)) { return(false); } foreach (KeyValuePair <string, AccessModifier> pair in this.fieldList) { if (!pair.Value.Type.FullName.Equals(parameter.fieldList[pair.Key].Type.FullName)) { return(false); } } return(true); }
// SSA #region Clone() /// <summary> /// Clones a type to be used in SSA. It must taken into account that: /// - In case it has no type variables, no clone is performed /// - WriteType variables, equivalence classes and substitutions are cloned /// </summary> /// <param name="clonedTypeVariables">WriteType variables that have been cloned.</param> /// <param name="equivalenceClasses">Equivalence classes of the type cloned variables. These /// equivalence classes need to be updated with the new cloned type variables.</param> /// <param name="methodAnalyzed">The method that is being analyzed when the operation is performed.</param> /// <returns>The cloned type</returns> internal override TypeExpression Clone(IDictionary <int, TypeVariable> clonedTypeVariables, IList <EquivalenceClass> equivalenceClasses, MethodType methodAnalyzed) { if (!this.HasTypeVariables()) { return(this); } ClassTypeProxy newClassProxy = (ClassTypeProxy)this.MemberwiseClone(); if (newClassProxy.realType != null) { newClassProxy.realType = (ClassType)newClassProxy.realType.Clone(clonedTypeVariables, equivalenceClasses, methodAnalyzed); } return(newClassProxy); }