Beispiel #1
0
        private static void HandleFieldReferenceOperation(OperationAnalysisContext context)
        {
            if (!context.SupportsTuples())
            {
                return;
            }

            var fieldReference = IFieldReferenceOperationWrapper.FromOperation(context.Operation);

            if (CheckFieldName(fieldReference.Field))
            {
                var location = fieldReference.WrappedOperation.Syntax is MemberAccessExpressionSyntax memberAccessExpression
                    ? memberAccessExpression.Name.GetLocation()
                    : fieldReference.WrappedOperation.Syntax.GetLocation();

                context.ReportDiagnostic(Diagnostic.Create(Descriptor, location));
            }
        }