Ejemplo n.º 1
0
        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);
        }
 private IType GetMostGenericType(BinaryExpression node)
 {
     return(TypeSystemServices.GetMostGenericType(GetExpressionType(node.Left), GetExpressionType(node.Right)));
 }