示例#1
0
        public override void VisitClassDeclaration(ClassDeclarationSyntax node)
        {
            long startTicks = Log.APPLICATIONSERVICES("Enter", Common.LOG_CATEGORY);

            if (_targetPatternRegEx.Match(node.Identifier.ToString()).Success)
            {
                RecordMatchAndContext(node, BlockType.ClassBlock);
            }

            base.VisitClassDeclaration(node);

            Log.APPLICATIONSERVICES("Exit", Common.LOG_CATEGORY, startTicks);
        }
示例#2
0
        public override void VisitImportsStatement(ImportsStatementSyntax node)
        {
            long startTicks = Log.APPLICATIONSERVICES("Enter", Common.LOG_CATEGORY);

            if (_targetPatternRegEx.Match(node.ImportsClauses.ToString()).Success)
            {
                RecordMatchAndContext(node, BlockType.None);
            }

            base.VisitImportsStatement(node);

            Log.APPLICATIONSERVICES("Exit", Common.LOG_CATEGORY, startTicks);
        }
示例#3
0
        public override void VisitUsingDirective(UsingDirectiveSyntax node)
        {
            long startTicks = Log.APPLICATIONSERVICES("Enter", Common.LOG_CATEGORY);

            if (_targetPatternRegEx.Match(node.ToString()).Success)
            {
                RecordMatchAndContext(node, BlockType.None);
            }

            base.VisitUsingDirective(node);

            Log.APPLICATIONSERVICES("Exit", Common.LOG_CATEGORY, startTicks);
        }
示例#4
0
        public override void VisitFieldDeclaration(FieldDeclarationSyntax node)
        {
            long startTicks = Log.APPLICATIONSERVICES("Enter", Common.LOG_CATEGORY);

            // Verify we have the correct context for the Field Declaration

            var parent = node.Parent;

            switch (_declarationLocation)
            {
            case VNC.CodeAnalysis.SyntaxNode.FieldDeclarationLocation.Class:
                if (parent.Kind() != SyntaxKind.ClassDeclaration)
                {
                    return;
                }
                break;

            case VNC.CodeAnalysis.SyntaxNode.FieldDeclarationLocation.Structure:
                if (parent.Kind() != SyntaxKind.StructDeclaration)
                {
                    return;
                }
                break;
            }

            if (_targetPatternRegEx.Match(node.ToString()).Success)
            {
                RecordMatchAndContext(node, BlockType.None);
            }

            // TODO(crhodes)
            // VB version has more code

            //foreach (var declarator in node.Declarators)
            //{
            //    if (_targetPatternRegEx.Match(declarator.Names.First().Identifier.ToString()).Success)
            //    {
            //        if (FilterByType(node.Declarators.First().AsClause))
            //        {
            //            RecordMatchAndContext(node, BlockType.None);
            //        }
            //    }
            //}

            base.VisitFieldDeclaration(node);

            Log.APPLICATIONSERVICES("Exit", Common.LOG_CATEGORY, startTicks);
        }