private static void AnalyzePropertyDeclaration(SyntaxNodeAnalysisContext context)
        {
            var propertyNode = (PropertyDeclarationSyntax)context.Node;

            if (!propertyNode.ContainsDiagnostics)
            {
                var propertySymbol = context.SemanticModel.GetDeclaredSymbol(propertyNode);
                var classSymbol    = propertySymbol.ContainingType;

                if (propertySymbol != null && classSymbol != null &&
                    classSymbol.IsStereotype() && !propertySymbol.IsAbstract &&
                    !propertySymbol.IsStatic)
                {
                    if (propertySymbol.GetMethod != null)
                    {
                        EvaluatePropertiesForSimplicityAnalyzer.AnalyzePropertyGetter(propertyNode, context);
                    }

                    if (propertySymbol.SetMethod != null)
                    {
                        EvaluatePropertiesForSimplicityAnalyzer.AnalyzePropertySetter(propertyNode, context);
                    }
                }
            }
        }
Exemplo n.º 2
0
 private static void AnalyzePropertyGetter(PropertyDeclarationSyntax propertyNode, SyntaxNodeAnalysisContext context)
 {
     if (propertyNode.ExpressionBody == null)
     {
         EvaluatePropertiesForSimplicityAnalyzer.AnalyzePropertyGetterWithGet(propertyNode, context);
     }
     else
     {
         EvaluatePropertiesForSimplicityAnalyzer.AnalyzePropertyGetterWithExpressionBody(propertyNode, context);
     }
 }