Ejemplo n.º 1
0
 public static SourceConstructorSymbol CreatePrimaryConstructorSymbol(
     SourceMemberContainerTypeSymbol containingType,
     ParameterListSyntax syntax,
     DiagnosticBag diagnostics)
 {
     return(new SourceConstructorSymbol(containingType, syntax.GetLocation(), syntax, diagnostics));
 }
Ejemplo n.º 2
0
        private static void Analyze(
            SyntaxNodeAnalysisContext context,
            ParameterListSyntax parameterList,
            SeparatedSyntaxList <ParameterSyntax> parameters)
        {
            if (parameterList
                .DescendantTrivia(parameterList.Span)
                .All(f => f.IsWhitespaceOrEndOfLineTrivia()))
            {
                context.ReportDiagnostic(
                    DiagnosticDescriptors.SimplifyLambdaExpressionParameterList,
                    parameterList.GetLocation());

                foreach (ParameterSyntax parameter in parameters)
                {
                    if (parameter.Type != null)
                    {
                        context.FadeOutNode(FadeOutDescriptor, parameter.Type);
                    }
                }

                if (parameters.Count == 1)
                {
                    context.FadeOutToken(FadeOutDescriptor, parameterList.OpenParenToken);
                    context.FadeOutToken(FadeOutDescriptor, parameterList.CloseParenToken);
                }
            }
        }
        private static void Analyze(SyntaxNodeAnalysisContext context, ParameterListSyntax parameterList)
        {
            if (parameterList
                .DescendantTrivia(parameterList.Span)
                .All(f => f.IsWhitespaceOrEndOfLineTrivia()))
            {
                context.ReportDiagnostic(
                    DiagnosticDescriptors.SimplifyLambdaExpressionParameterList,
                    parameterList.GetLocation());

                FadeOut(context, parameterList);
            }
        }