Пример #1
0
        int GetGlobalNewLinesFor(AstNode child)
        {
            int newLines    = 1;
            var nextSibling = child.GetNextSibling(NoWhitespacePredicate);

            if ((child is UsingDeclaration || child is UsingAliasDeclaration) && !(nextSibling is UsingDeclaration || nextSibling is UsingAliasDeclaration))
            {
                newLines += policy.BlankLinesAfterUsings;
            }
            else if ((child is TypeDeclaration) && (nextSibling is TypeDeclaration))
            {
                newLines += policy.BlankLinesBetweenTypes;
            }

            return(newLines);
        }
Пример #2
0
        int GetTypeLevelNewLinesFor(AstNode child)
        {
            var blankLines  = 1;
            var nextSibling = child.GetNextSibling(NoWhitespacePredicate);

            if (child is EventDeclaration)
            {
                if (nextSibling is EventDeclaration)
                {
                    blankLines += policy.BlankLinesBetweenEventFields;
                    return(blankLines);
                }
            }

            if (child is FieldDeclaration || child is FixedFieldDeclaration)
            {
                if (nextSibling is FieldDeclaration || nextSibling is FixedFieldDeclaration)
                {
                    blankLines += policy.BlankLinesBetweenFields;
                    return(blankLines);
                }
            }

            if (child is TypeDeclaration)
            {
                if (nextSibling is TypeDeclaration)
                {
                    blankLines += policy.BlankLinesBetweenTypes;
                    return(blankLines);
                }
            }

            if (nextSibling.Role == Roles.TypeMemberRole)
            {
                blankLines += policy.BlankLinesBetweenMembers;
            }

            return(blankLines);
        }