private void Walk(TypeDefinition typeDefinition) { var baseTypeHandle = typeDefinition.BaseType; if (baseTypeHandle.IsNil) { return; } var handleType = baseTypeHandle.HandleType; if (handleType == HandleType.Type) { typeDefinition = metadataReader.GetTypeDefinition((TypeHandle)baseTypeHandle); var typeFullName = metadataReader.GetFullTypeName(typeDefinition); if (knownExportAttributeOrDerivedType.Contains(typeFullName)) { typeFullName = metadataReader.GetFullTypeName(typeDefinition); knownExportAttributeOrDerivedType.Add(typeFullName); //isExportAttributeCache[baseTypeHandle] = ExportOrInheritedExport.Export; return; } else if (knownImportAttributeOrDerivedType.Contains(typeFullName)) { typeFullName = metadataReader.GetFullTypeName(typeDefinition); knownImportAttributeOrDerivedType.Add(typeFullName); //isImportAttributeCache[baseTypeHandle] = true; return; } Walk(typeDefinition); } else if (handleType == HandleType.TypeReference) { TypeReference typeReference = metadataReader.GetTypeReference((TypeReferenceHandle)baseTypeHandle); var typeFullName = metadataReader.GetFullTypeName(typeReference); if (knownExportAttributeOrDerivedType.Contains(typeFullName)) { typeFullName = metadataReader.GetFullTypeName(typeDefinition); knownExportAttributeOrDerivedType.Add(typeFullName); //isExportAttributeCache[baseTypeHandle] = ExportOrInheritedExport.Export; return; } else if (knownImportAttributeOrDerivedType.Contains(typeFullName)) { typeFullName = metadataReader.GetFullTypeName(typeDefinition); knownImportAttributeOrDerivedType.Add(typeFullName); //isImportAttributeCache[baseTypeHandle] = true; return; } } else if (handleType == HandleType.TypeSpecification) { // TODO: not implemented } else { throw new NotImplementedException(); } }
public static string GetFullTypeName(this MetadataReader metadataReader, TypeHandle typeHandle) { var typeDefinition = metadataReader.GetTypeDefinition(typeHandle); return(metadataReader.GetFullTypeName(typeDefinition)); }