Exemplo n.º 1
0
        public static MemberDecoration GetModifiers(this TypePart typePart)
        {
            var sigPart = GetPartFromSignature(typePart);

            if (sigPart != null)
            {
                return(Normalize(sigPart.Modifiers));
            }

            if (typePart == null)
            {
                return(MemberDecoration.DefaultValue);
            }

            var decoration = typePart.Modifiers;

            if (typePart.GetRoot() is FSharpProjectFilePart {
                HasPairFile : true
            })
Exemplo n.º 2
0
        public static MemberDecoration GetModifiers(this TypePart typePart)
        {
            var sigPart = GetPartFromSignature(typePart);

            if (sigPart != null)
            {
                return(Normalize(sigPart.Modifiers));
            }

            if (typePart == null)
            {
                return(MemberDecoration.DefaultValue);
            }

            var decoration          = typePart.Modifiers;
            var isHiddenBySignature = (typePart.GetRoot() as FSharpProjectFilePart)?.HasPairFile ?? false;

            if (isHiddenBySignature)
            {
                decoration.AccessRights = AccessRights.INTERNAL;
            }

            return(Normalize(decoration));
        }
Exemplo n.º 3
0
        public static MemberDecoration GetModifiers(this TypePart typePart)
        {
            var sigPart = GetPartFromSignature(typePart);

            if (sigPart != null)
            {
                return(Normalize(sigPart.Modifiers));
            }

            if (typePart == null)
            {
                return(MemberDecoration.DefaultValue);
            }

            var decoration = typePart.Modifiers;

            if (typePart.GetRoot() is FSharpProjectFilePart projectFilePart && projectFilePart.HasPairFile)
            {
                // We already know there's no type part in a signature file.
                // If there's a signature file then this type is hidden.
                decoration.AccessRights = AccessRights.INTERNAL;
            }

            if (typePart is TypeAbbreviationOrDeclarationPartBase part && !part.IsUnionCase)
            {
                // Type abbreviation is a union case declaration when its right part is a simple named type
                // that is not resolved to anything.
                // When the part is abbreviation, we modify it's visibility to hide from other languages.
                //
                // We cannot set it directly in the part modifiers,
                // since it depends on resolve which needs committed documents and is slow.
                decoration.AccessRights = AccessRights.INTERNAL;
            }

            return(Normalize(decoration));
        }