internal static ITypeReference ConvertAttributeType(AstType type) { ITypeReference tr = type.ToTypeReference(); if (!type.GetChildByRole(AstNode.Roles.Identifier).IsVerbatim) { // Try to add "Attribute" suffix, but only if the identifier // (=last identifier in fully qualified name) isn't a verbatim identifier. SimpleTypeOrNamespaceReference st = tr as SimpleTypeOrNamespaceReference; MemberTypeOrNamespaceReference mt = tr as MemberTypeOrNamespaceReference; if (st != null) return new AttributeTypeReference(st, st.AddSuffix("Attribute")); else if (mt != null) return new AttributeTypeReference(mt, mt.AddSuffix("Attribute")); } return tr; }
IMemberReference ConvertInterfaceImplementation(AstType interfaceType, AbstractUnresolvedMember unresolvedMember) { ITypeReference interfaceTypeReference = interfaceType.ToTypeReference(); int typeParameterCount = 0; IList<ITypeReference> parameterTypes = null; if (unresolvedMember.EntityType == EntityType.Method) { typeParameterCount = ((IUnresolvedMethod)unresolvedMember).TypeParameters.Count; } IUnresolvedParameterizedMember parameterizedMember = unresolvedMember as IUnresolvedParameterizedMember; if (parameterizedMember != null) { parameterTypes = new ITypeReference[parameterizedMember.Parameters.Count]; for (int i = 0; i < parameterTypes.Count; i++) { parameterTypes[i] = parameterizedMember.Parameters[i].Type; } } return new DefaultMemberReference(unresolvedMember.EntityType, interfaceTypeReference, unresolvedMember.Name, typeParameterCount, parameterTypes); }
public static ITypeReference ConvertType(AstType type, SimpleNameLookupMode lookupMode = SimpleNameLookupMode.Type) { return type.ToTypeReference(lookupMode); }