public TypeReference ImportType(TypeReference type, ImportGenericContext context) { if (type.IsTypeSpecification()) return ImportTypeSpecification(type, context); var reference = new TypeReference( type.Namespace, type.Name, module, ImportScope(type.Scope), type.IsValueType); MetadataSystem.TryProcessPrimitiveTypeReference(reference); if (type.IsNested) reference.DeclaringType = ImportType(type.DeclaringType, context); if (type.HasGenericParameters) ImportGenericParameters(reference, type); return reference; }
static bool AreSame(TypeReference a, TypeReference b) { if (ReferenceEquals(a, b)) return true; if (a == null || b == null) return false; if (a.etype != b.etype) return false; if (a.IsGenericParameter) return AreSame((GenericParameter)a, (GenericParameter)b); if (a.IsTypeSpecification()) return AreSame((TypeSpecification)a, (TypeSpecification)b); if (a.Name != b.Name || a.Namespace != b.Namespace) return false; //TODO: check scope return AreSame(a.DeclaringType, b.DeclaringType); }