GetSelfTypeMask() public method

Gets self type for this context.
public GetSelfTypeMask ( ) : TypeRefMask
return TypeRefMask
        /// <summary>
        /// Gets type mask representing given type name.
        /// </summary>
        public static TypeRefMask GetTypeMask(TypeRefContext /*!*/ typeCtx, string tname, NamingContext naming, bool fullyQualified = false)
        {
            if (!string.IsNullOrEmpty(tname))
            {
                // handle various array conventions
                if (tname.LastCharacter() == ']')
                {
                    // "TName[]"
                    if (tname.EndsWith("[]", StringComparison.Ordinal))
                    {
                        var elementType = GetTypeMask(typeCtx, tname.Remove(tname.Length - 2), naming, fullyQualified);
                        return(typeCtx.GetArrayTypeMask(elementType));
                    }

                    // "array[TName]"
                    var arrayTypeName = QualifiedName.Array.Name.Value;
                    if (tname.Length > arrayTypeName.Length && tname[arrayTypeName.Length] == '[' &&
                        tname.StartsWith(arrayTypeName, StringComparison.OrdinalIgnoreCase))
                    {
                        var elementTypeName = tname.Substring(arrayTypeName.Length + 1, tname.Length - arrayTypeName.Length - 2);
                        var elementType     = GetTypeMask(typeCtx, elementTypeName, naming, fullyQualified);
                        return(typeCtx.GetArrayTypeMask(elementType));
                    }

                    // unknown something // ...
                }
                else if (tname[0] == '&')
                {
                    return(GetTypeMask(typeCtx, tname.Substring(1), naming, fullyQualified).WithRefFlag);
                }
                else
                {
                    var result = GetKnownTypeMask(typeCtx, tname);
                    if (result.IsUninitialized)
                    {
                        var qname = NameUtils.MakeQualifiedName(tname, false);
                        if (!fullyQualified && naming != null && !qname.IsReservedClassName)
                        {
                            qname = QualifiedName.TranslateAlias(qname, AliasKind.Type, naming.Aliases, naming.CurrentNamespace);
                        }

                        if (qname.IsPrimitiveTypeName)
                        {
                            result = GetKnownTypeMask(typeCtx, qname.Name.Value);
                            if (!result.IsUninitialized)
                            {
                                return(result);
                            }
                        }

                        if (qname.IsSelfClassName)
                        {
                            return(typeCtx.GetSelfTypeMask());
                        }

                        result = BoundTypeRefFactory.Create(qname, typeCtx.SelfType as SourceTypeSymbol).GetTypeRefMask(typeCtx);
                    }

                    //Contract.Assert(!result.IsUninitialized);
                    return(result);
                }
            }

            return(0);
        }