Example #1
0
        SyntaxNode RemoveExplicitPrivateModifiers(SyntaxNode actualSourceCode)
        {
            var modifiedSourceNode = actualSourceCode;

            if (CheckOption((int)CleanupTypes.RemoveClassMethodsPrivateModifier))
            {
                var remover = new MethodTokenRemover(IsReportOnlyMode);
                modifiedSourceNode = remover.Remove(modifiedSourceNode) ?? modifiedSourceNode;

                if (IsReportOnlyMode && !IsEquivalentToUNModified(modifiedSourceNode))
                {
                    CollectMessages(remover.GetReport());
                }
            }

            if (CheckOption((int)CleanupTypes.RemoveClassFieldsPrivateModifier))
            {
                var remover = new FieldTokenRemover(IsReportOnlyMode);
                modifiedSourceNode = remover.Remove(modifiedSourceNode) ?? modifiedSourceNode;

                if (IsReportOnlyMode && !IsEquivalentToUNModified(modifiedSourceNode))
                {
                    CollectMessages(remover.GetReport());
                }
            }

            if (CheckOption((int)CleanupTypes.RemoveClassPropertiesPrivateModifier))
            {
                var remover = new PropertyTokenRemover(IsReportOnlyMode);
                modifiedSourceNode = remover.Remove(modifiedSourceNode) ?? modifiedSourceNode;

                if (IsReportOnlyMode && !IsEquivalentToUNModified(modifiedSourceNode))
                {
                    CollectMessages(remover.GetReport());
                }
            }

            if (CheckOption((int)CleanupTypes.RemoveNestedClassPrivateModifier))
            {
                var remover = new NestedClassTokenRemover(IsReportOnlyMode);
                modifiedSourceNode = remover.Remove(modifiedSourceNode) ?? modifiedSourceNode;

                if (IsReportOnlyMode && !IsEquivalentToUNModified(modifiedSourceNode))
                {
                    CollectMessages(remover.GetReport());
                }
            }

            if (IsReportOnlyMode)
            {
                return(actualSourceCode);
            }
            return(modifiedSourceNode);
        }
 SyntaxNode RemoveExplicitPrivateModifiers(SyntaxNode actualSourceCode)
 {
     if (CheckOption((int)CleanupTypes.Remove_Class_Methods_Private_Modifier))
     {
         actualSourceCode = new MethodTokenRemover().Remove(actualSourceCode) ?? actualSourceCode;
     }
     if (CheckOption((int)CleanupTypes.Remove_Class_Fields_Private_Modifier))
     {
         actualSourceCode = new FieldTokenRemover().Remove(actualSourceCode) ?? actualSourceCode;
     }
     if (CheckOption((int)CleanupTypes.Remove_Class_Properties_Private_Modifier))
     {
         actualSourceCode = new PropertyTokenRemover().Remove(actualSourceCode) ?? actualSourceCode;
     }
     if (CheckOption((int)CleanupTypes.Remove_Nested_Class_Private_Modifier))
     {
         actualSourceCode = new NestedClassTokenRemover().Remove(actualSourceCode) ?? actualSourceCode;
     }
     return(actualSourceCode);
 }