Пример #1
0
        internal static Type GetActualType(this AstType astType)
        {
            ComposedType composedType = astType as ComposedType;

            if (composedType != null)
            {
                return(composedType.GetActualType());
            }

            PrimitiveType primitiveType = astType as PrimitiveType;

            if (primitiveType != null)
            {
                return(primitiveType.GetActualType());
            }

            MemberType memberType = astType as MemberType;

            if (memberType != null)
            {
                return(memberType.GetActualType());
            }

            var simpleType = astType as SimpleType;

            if (simpleType != null)
            {
                return(simpleType.GetActualType());
            }

            if (astType.HasAnnotations())
            {
                var typeReference = astType.Annotation <TypeReference>();

                if (typeReference != null)
                {
                    return(typeReference.GetActualType());
                }

                var typeDefinition = astType.Annotation <TypeDefinition>();

                if (typeDefinition != null)
                {
                    return(typeDefinition.GetActualType());
                }
            }

            return(null);
        }