private static TypeReference CreateReference(TypeParser.Type type_info, ModuleDefinition module, IMetadataScope scope) { string @namespace; string name; TypeParser.SplitFullName(type_info.type_fullname, out @namespace, out name); TypeReference typeReference = new TypeReference(@namespace, name, module, scope); MetadataSystem.TryProcessPrimitiveTypeReference(typeReference); TypeParser.AdjustGenericParameters(typeReference); string[] nested_names = type_info.nested_names; if (nested_names.IsNullOrEmpty <string>()) { return(typeReference); } for (int i = 0; i < nested_names.Length; i++) { typeReference = new TypeReference(string.Empty, nested_names[i], module, null) { DeclaringType = typeReference }; TypeParser.AdjustGenericParameters(typeReference); } return(typeReference); }
private TypeReference ImportType(TypeReference type, ImportGenericContext context) { if (type.IsTypeSpecification()) { return(this.ImportTypeSpecification(type, context)); } TypeReference typeReference = new TypeReference(type.Namespace, type.Name, this.module, this.ImportScope(type.Scope), type.IsValueType); MetadataSystem.TryProcessPrimitiveTypeReference(typeReference); if (type.IsNested) { typeReference.DeclaringType = this.ImportType(type.DeclaringType, context); } if (type.HasGenericParameters) { MetadataImporter.ImportGenericParameters(typeReference, type); } return(typeReference); }