IType GetEnumeratorItemTypeFromAttribute(IType iteratorType) { // If iterator type is external get its attributes via reflection if (iteratorType is ExternalType) { return(GetExternalEnumeratorItemType(iteratorType)); } // If iterator type is a generic constructed type, map its attribute from its definition GenericConstructedType constructedType = iteratorType as GenericConstructedType; if (constructedType != null) { return(constructedType.GenericMapping.Map( GetEnumeratorItemTypeFromAttribute(constructedType.GenericDefinition))); } // If iterator type is internal get its attributes from its type definition AbstractInternalType internalType = (AbstractInternalType)iteratorType; IType enumeratorItemTypeAttribute = Map(typeof(EnumeratorItemTypeAttribute)); foreach (Attribute attribute in internalType.TypeDefinition.Attributes) { IConstructor constructor = GetEntity(attribute) as IConstructor; if (null != constructor) { if (constructor.DeclaringType == enumeratorItemTypeAttribute) { return(GetType(attribute.Arguments[0])); } } } return(null); }
IType GetEnumeratorItemTypeFromAttribute(IType iteratorType) { AbstractInternalType internalType = iteratorType as AbstractInternalType; if (null == internalType) { return(GetExternalEnumeratorItemType(iteratorType)); } IType enumeratorItemTypeAttribute = Map(typeof(EnumeratorItemTypeAttribute)); foreach (Attribute attribute in internalType.TypeDefinition.Attributes) { IConstructor constructor = GetEntity(attribute) as IConstructor; if (null != constructor) { if (constructor.DeclaringType == enumeratorItemTypeAttribute) { return(GetType(attribute.Arguments[0])); } } } return(null); }
private void CheckForCycles(TypeReference baseTypeRef, AbstractInternalType baseType, List<TypeDefinition> visited) { if (visited.Contains(baseType.TypeDefinition)) { BaseTypeError(CompilerErrorFactory.InheritanceCycle(baseTypeRef, baseType.FullName)); return; } new BaseTypeResolution(Context, baseType.TypeDefinition, visited); }
public InternalGenericParameter(TypeSystemServices tss, GenericParameterDeclaration declaration, AbstractInternalType declaringType, int position) : this(tss, declaration, position) { _declaringType = declaringType; }