IType InferGeneratorItemTypeFor(InternalMethod generator)
        {
            if (TypeSystemServices.IsGenericGeneratorReturnType(generator.ReturnType))
            {
                return(generator.ReturnType.ConstructedInfo.GenericArguments[0]);
            }

            var yieldExpressions = generator.YieldExpressions;

            return(yieldExpressions.Count > 0
                                ? TypeSystemServices.GetMostGenericType(yieldExpressions)
                                : TypeSystemServices.ObjectType);
        }
Beispiel #2
0
 private IType GeneratorItemTypeFrom(IType expectedType)
 {
     return(TypeSystemServices.IsGenericGeneratorReturnType(expectedType) ? expectedType.ConstructedInfo.GenericArguments[0] : null);
 }