public InterfaceMethodInfo(TypeInfo iface, InterfaceMethodInfo other) { this.iface = iface; foreach (var key in other.ifaceMethodToClassMethod.Keys) { ifaceMethodToClassMethod[key] = other.ifaceMethodToClassMethod[key]; } }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object" />. /// </returns> /// <filterpriority>2</filterpriority> public override int GetHashCode() { int hash1 = InterfaceMethodInfo != null?InterfaceMethodInfo.GetHashCode() : 0; int hash2 = ImplementationMethodInfo != null?ImplementationMethodInfo.GetHashCode() : 0; return(hash1 * 23 ^ hash2 * 7); }
public void AddInterface(TypeInfo iface) { var key = iface.typeRef; if (!interfaceMethods.ContainsKey(key)) { interfaceMethods[key] = new InterfaceMethodInfo(iface); } }
public void Merge(InterfaceMethodInfo other) { foreach (var key in other.ifaceMethodToClassMethod.Keys) { if (other.ifaceMethodToClassMethod[key] == null) { continue; } if (ifaceMethodToClassMethod[key] != null) { throw new ApplicationException("Interface method already initialized"); } ifaceMethodToClassMethod[key] = other.ifaceMethodToClassMethod[key]; } }
public void InitializeFrom(InterfaceMethodInfos other, GenericInstSig git) { foreach (var pair in other.interfaceMethods) { var oldTypeInfo = pair.Value.IFace; var newTypeInfo = new TypeInfo(oldTypeInfo, git); var oldKey = oldTypeInfo.typeRef; var newKey = newTypeInfo.typeRef; var newMethodsInfo = new InterfaceMethodInfo(newTypeInfo, other.interfaceMethods[oldKey]); if (interfaceMethods.ContainsKey(newKey)) { newMethodsInfo.Merge(interfaceMethods[newKey]); } interfaceMethods[newKey] = newMethodsInfo; } }