GetNullTypeMask() public method

Gets type mask corresponding to System.Object and not including any subclasses.
public GetNullTypeMask ( ) : TypeRefMask
return TypeRefMask
Beispiel #1
0
        /// <summary>
        /// Gets type mask of the literal within given type context.
        /// </summary>
        internal TypeRefMask ResolveTypeMask(TypeRefContext typeCtx)
        {
            Debug.Assert(this.ConstantValue.HasValue);
            var value = this.ConstantValue.Value;

            if (value == null)
            {
                return typeCtx.GetNullTypeMask();
            }
            else
            {
                if (value is long || value is int)
                {
                    return typeCtx.GetLongTypeMask();
                }
                else if (value is string)
                {
                    return typeCtx.GetStringTypeMask();
                }
                else if (value is bool)
                {
                    return typeCtx.GetBooleanTypeMask();
                }
                else if (value is double)
                {
                    return typeCtx.GetDoubleTypeMask();
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Merges given types coming from two flows.
        /// Uninitialized value (<c>0L</c>) is treated as <c>NULL</c>.
        /// </summary>
        TypeRefMask MergeType(TypeRefMask t1, TypeRefMask t2)
        {
            var result = t1 | t2;

            if (t1.IsDefault || t2.IsDefault)
            {
                result |= TypeRefContext.GetNullTypeMask();
            }

            return(result);
        }