Exemplo n.º 1
0
            public override void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node)
            {
                var lastEmbeddedNode = embeddedNode;

                if (entryNode == null)
                {
                    entryNode = node;
                }
                else
                {
                    embeddedNode = node;
                }
                _depthParenthesizedExpression++;
                InsertLLOCMap(node.GetLocation());
                InsertLLOCMap(node.OpenParenToken.GetLocation());
                InsertLLOCMap(node.CloseParenToken.GetLocation());
                _weInAnonymousMethod = true;
                base.VisitParenthesizedExpression(node);
                _weInAnonymousMethod = false;
                _depthParenthesizedExpression--;
                embeddedNode = lastEmbeddedNode;
                if (_depthSimpleLambdaExpression == 0 && _depthParenthesizedExpression == 0 && _depthAnonymousMethodExpression == 0)
                {
                    entryNode = null;
                }
            }
Exemplo n.º 2
0
 private static void ReportDiagnostic(SyntaxNodeAnalysisContext context, ParenthesizedExpressionSyntax node)
 {
     context.ReportDiagnostic(Diagnostic.Create(Descriptor, node.GetLocation()));
     context.ReportDiagnostic(Diagnostic.Create(ParenthesisDescriptor, node.OpenParenToken.GetLocation()));
     context.ReportDiagnostic(Diagnostic.Create(ParenthesisDescriptor, node.CloseParenToken.GetLocation()));
 }
 private static void ReportDiagnostic(SyntaxNodeAnalysisContext context, ParenthesizedExpressionSyntax node)
 {
     context.ReportDiagnostic(Diagnostic.Create(Descriptor, node.GetLocation()));
     context.ReportDiagnostic(Diagnostic.Create(ParenthesisDescriptor, node.OpenParenToken.GetLocation()));
     context.ReportDiagnostic(Diagnostic.Create(ParenthesisDescriptor, node.CloseParenToken.GetLocation()));
 }