Esempio n. 1
0
        private static bool IsInstantiableExceptionType([NotNull] IDeclaredType declaredType, [NotNull] ICSharpExpression context)
        {
            var predefinedType = context.GetPredefinedType();
            var conversionRule = context.GetTypeConversionRule();

            return(conversionRule.IsImplicitlyConvertibleTo(declaredType, predefinedType.Exception) &&
                   TypeUtils.CanInstantiateType(declaredType, context) != CanInstantiate.No);
        }
Esempio n. 2
0
        private static IType GetQualifierType([NotNull] ICSharpExpression qualifier, [NotNull] out IType filterType)
        {
            var qualifierType = filterType = qualifier.Type();

            if (qualifierType.IsResolved)
            {
                return(qualifierType);
            }

            var enumType = FindEnumerationType(qualifier);

            if (enumType == null)
            {
                return(null);
            }

            filterType = qualifier.GetPredefinedType().Type;
            return(enumType);
        }