Ejemplo n.º 1
0
        public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
        {
            LackOfCohesionAnalyzer lackOfCohesionAnalyzer = this;

            lackOfCohesionAnalyzer.numMethods = checked (lackOfCohesionAnalyzer.numMethods + 1);
            this.FilterFieldAccessExpressions(node);
            base.VisitMethodDeclaration(node);
        }
Ejemplo n.º 2
0
        private void FilterInstanceAutoProperties(IEnumerable <PropertyDeclarationSyntax> nodes)
        {
            bool flag;

            foreach (PropertyDeclarationSyntax node in nodes)
            {
                if (((IEnumerable <SyntaxToken>)node.Modifiers).Any <SyntaxToken>((SyntaxToken x) => x.ValueText == "static"))
                {
                    continue;
                }
                if (node.AccessorList == null)
                {
                    continue;
                }
                SyntaxList <AccessorDeclarationSyntax> accessors     = node.AccessorList.Accessors;
                AccessorDeclarationSyntax accessorDeclarationSyntax  = ((IEnumerable <AccessorDeclarationSyntax>)accessors).SingleOrDefault <AccessorDeclarationSyntax>((AccessorDeclarationSyntax syntax) => syntax.Kind() == SyntaxKind.GetAccessorDeclaration);
                AccessorDeclarationSyntax accessorDeclarationSyntax1 = ((IEnumerable <AccessorDeclarationSyntax>)accessors).SingleOrDefault <AccessorDeclarationSyntax>((AccessorDeclarationSyntax syntax) => syntax.Kind() == SyntaxKind.SetAccessorDeclaration);
                if (accessorDeclarationSyntax == null && accessorDeclarationSyntax1 == null)
                {
                    continue;
                }
                if (accessorDeclarationSyntax == null || accessorDeclarationSyntax.Body == null)
                {
                    flag = (accessorDeclarationSyntax1 == null ? true : accessorDeclarationSyntax1.Body == null);
                }
                else
                {
                    flag = false;
                }
                if (!flag)
                {
                    continue;
                }
                LackOfCohesionAnalyzer lackOfCohesionAnalyzer = this;
                lackOfCohesionAnalyzer.numFields = checked (lackOfCohesionAnalyzer.numFields + 1);
                ISymbol declaredSymbol = this.model.GetDeclaredSymbol(node, new CancellationToken());
                if (declaredSymbol == null)
                {
                    continue;
                }
                this.numFieldAccesses[declaredSymbol.Name] = 0;
            }
        }
Ejemplo n.º 3
0
 private void FilterInstanceFieldDeclarations(IEnumerable <FieldDeclarationSyntax> nodes)
 {
     foreach (FieldDeclarationSyntax node in nodes)
     {
         LackOfCohesionAnalyzer lackOfCohesionAnalyzer = this;
         lackOfCohesionAnalyzer.numFields = checked (lackOfCohesionAnalyzer.numFields + 1);
         if (((IEnumerable <SyntaxToken>)node.Modifiers).Any <SyntaxToken>((SyntaxToken x) => x.ValueText == "static"))
         {
             continue;
         }
         LackOfCohesionAnalyzer lackOfCohesionAnalyzer1 = this;
         lackOfCohesionAnalyzer1.numInstanceFields = checked (lackOfCohesionAnalyzer1.numInstanceFields + 1);
         ISymbol declaredSymbol = node.GetDeclaredSymbol(this.model);
         if (declaredSymbol == null)
         {
             continue;
         }
         this.numFieldAccesses[declaredSymbol.Name] = 0;
     }
 }
Ejemplo n.º 4
0
        private void FilterAccessors(AccessorListSyntax accessorList, params SyntaxKind[] accessorKinds)
        {
            if (accessorList == null)
            {
                return;
            }
            SyntaxList <AccessorDeclarationSyntax> accessors = accessorList.Accessors;

            SyntaxKind[] syntaxKindArray = accessorKinds;
            for (int i = 0; i < (int)syntaxKindArray.Length; i++)
            {
                SyntaxKind syntaxKind = syntaxKindArray[i];
                AccessorDeclarationSyntax accessorDeclarationSyntax = ((IEnumerable <AccessorDeclarationSyntax>)accessors).SingleOrDefault <AccessorDeclarationSyntax>((AccessorDeclarationSyntax syntax) => syntax.Kind() == syntaxKind);
                if (accessorDeclarationSyntax != null && accessorDeclarationSyntax.Body != null)
                {
                    LackOfCohesionAnalyzer lackOfCohesionAnalyzer = this;
                    lackOfCohesionAnalyzer.numMethods = checked (lackOfCohesionAnalyzer.numMethods + 1);
                    this.FilterFieldAccessExpressions(accessorDeclarationSyntax.Body);
                }
            }
        }