Exemple #1
0
        /// <summary>
        /// Tests if a particular type is an integer type.
        /// </summary>
        /// <param name="type">The type to examine.</param>
        /// <returns>
        /// <c>true</c> if <paramref name="type"/> has an integer spec;
        /// otherwise, <c>false</c>.
        /// </returns>
        public static bool IsIntegerType(this IType type)
        {
            var attr = type.Attributes.GetOrNull(
                IntrinsicAttribute.GetIntrinsicAttributeType(AttributeName));

            return(attr != null);
        }
Exemple #2
0
        /// <summary>
        /// Gets a type's integer spec if it has one.
        /// </summary>
        /// <param name="type">The type to examine.</param>
        /// <returns>
        /// An integer spec if <paramref name="type"/> has one; otherwise, <c>null</c>.
        /// </returns>
        public static IntegerSpec GetIntegerSpecOrNull(this IType type)
        {
            var attr = type.Attributes.GetOrNull(
                IntrinsicAttribute.GetIntrinsicAttributeType(AttributeName));

            if (attr == null)
            {
                return(null);
            }
            else
            {
                return(Read((IntrinsicAttribute)attr));
            }
        }
Exemple #3
0
        /// <summary>
        /// Gets a member's access modifier. Members are internal by default.
        /// </summary>
        /// <param name="member">The member to examine.</param>
        /// <returns>The member's access modifier if it has one; otherwise, internal.</returns>
        public static AccessModifier GetAccessModifier(this IMember member)
        {
            var attr = member.Attributes.GetOrNull(
                IntrinsicAttribute.GetIntrinsicAttributeType(AttributeName));

            if (attr == null)
            {
                return(AccessModifier.Internal);
            }
            else
            {
                return(Read((IntrinsicAttribute)attr));
            }
        }