Пример #1
0
        /// <summary>
        /// Enumerates through all the <see cref="MethodDeclarationSyntax"/>es collected by the <paramref name="syntaxReceiver"/> and returns an array of <see cref="DefaultParamMethodData"/>s created from the valid ones.
        /// </summary>
        /// <param name="compilation">Current <see cref="DefaultParamCompilationData"/>.</param>
        /// <param name="syntaxReceiver"><see cref="DefaultParamSyntaxReceiver"/> that collected the <see cref="MethodDeclarationSyntax"/>es.</param>
        /// <param name="cancellationToken"><see cref="CancellationToken"/> that specifies if the operation should be canceled.</param>
        public static DefaultParamMethodData[] GetValidMethods(
            DefaultParamCompilationData compilation,
            DefaultParamSyntaxReceiver syntaxReceiver,
            CancellationToken cancellationToken = default
            )
        {
            if (compilation is null || syntaxReceiver is null || syntaxReceiver.CandidateMethods.Count == 0)
            {
                return(Array.Empty <DefaultParamMethodData>());
            }

            return(GetValidMethods_Internal(compilation, syntaxReceiver.CandidateMethods.ToArray(), cancellationToken));
        }
            /// <summary>
            /// Enumerates through all the <see cref="DelegateDeclarationSyntax"/>es collected by the <paramref name="syntaxReceiver"/> and returns an array of <see cref="DefaultParamDelegateData"/>s created from the valid ones.
            /// </summary>
            /// <param name="diagnosticReceiver"><see cref="IDiagnosticReceiver"/> that is used to report <see cref="Diagnostic"/>s.</param>
            /// <param name="compilation">Current <see cref="DefaultParamCompilationData"/>.</param>
            /// <param name="syntaxReceiver"><see cref="DefaultParamSyntaxReceiver"/> that collected the <see cref="DelegateDeclarationSyntax"/>es.</param>
            /// <param name="cancellationToken"><see cref="CancellationToken"/> that specifies if the operation should be canceled.</param>
            public static DefaultParamDelegateData[] GetValidDelegates(
                IDiagnosticReceiver diagnosticReceiver,
                DefaultParamCompilationData compilation,
                DefaultParamSyntaxReceiver syntaxReceiver,
                CancellationToken cancellationToken = default
                )
            {
                if (compilation is null || diagnosticReceiver is null || syntaxReceiver is null || syntaxReceiver.CandidateDelegates.Count == 0)
                {
                    return(Array.Empty <DefaultParamDelegateData>());
                }

                return(GetValidDelegates_Internal(diagnosticReceiver, compilation, syntaxReceiver.CandidateDelegates.ToArray(), cancellationToken));
            }
Пример #3
0
        /// <summary>
        /// Reports <see cref="Diagnostic"/> s for <see cref="LocalFunctionStatementSyntax"/> es
        /// returned by the <see cref="GetCandidateLocalFunctions()"/> method.
        /// </summary>
        /// <param name="diagnosticReceiver">
        /// <see cref="IDiagnosticReceiver"/> that is used to report <see cref="Diagnostic"/> s.
        /// </param>
        /// <param name="compilation">Current <see cref="DefaultParamCompilationData"/>.</param>
        /// <param name="syntaxReceiver">
        /// <see cref="DefaultParamSyntaxReceiver"/> that collected the <see
        /// cref="LocalFunctionStatementSyntax"/> to report <see cref="Diagnostic"/> for.
        /// </param>
        /// <param name="cancellationToken">
        /// <see cref="CancellationToken"/> that specifies if the operation should be canceled.
        /// </param>
        public static void ReportDiagnosticsForLocalFunctions(
            IDiagnosticReceiver diagnosticReceiver,
            DefaultParamCompilationData compilation,
            DefaultParamSyntaxReceiver syntaxReceiver,
            CancellationToken cancellationToken = default
            )
        {
            if (diagnosticReceiver is null || compilation is null || syntaxReceiver is null || syntaxReceiver.CandidateLocalFunctions is null || syntaxReceiver.CandidateLocalFunctions.Count == 0)
            {
                return;
            }

            foreach (LocalFunctionStatementSyntax fn in syntaxReceiver.CandidateLocalFunctions)
            {
                ReportDiagnosticsForLocalFunction(diagnosticReceiver, compilation, fn, cancellationToken);
            }
        }
Пример #4
0
 /// <summary>
 /// Enumerates through all the <see cref="MethodDeclarationSyntax"/>es collected by the <paramref name="syntaxReceiver"/> and returns an array of <see cref="DefaultParamMethodData"/>s created from the valid ones. If the target <see cref="DefaultParamMethodData"/> already exists in the specified <paramref name="cache"/>, includes it instead.
 /// </summary>
 /// <param name="compilation">Current <see cref="DefaultParamCompilationData"/>.</param>
 /// <param name="syntaxReceiver"><see cref="DefaultParamSyntaxReceiver"/> that collected the <see cref="MethodDeclarationSyntax"/>es.</param>
 /// <param name="cache">Container of cached <see cref="DefaultParamMethodData"/>s.</param>
 /// <param name="cancellationToken"><see cref="CancellationToken"/> that specifies if the operation should be canceled.</param>
 public static DefaultParamMethodData[] GetValidMethods(
     DefaultParamCompilationData compilation,
     DefaultParamSyntaxReceiver syntaxReceiver,
     in CachedData <DefaultParamMethodData> cache,
 /// <summary>
 /// Enumerates through all the <see cref="DelegateDeclarationSyntax"/>es collected by the <paramref name="syntaxReceiver"/> and returns an array of <see cref="DefaultParamDelegateData"/>s created from the valid ones. If the target <see cref="DefaultParamDelegateData"/> already exists in the specified <paramref name="cache"/>, includes it instead.
 /// </summary>
 /// <param name="diagnosticReceiver"><see cref="IDiagnosticReceiver"/> that is used to report <see cref="Diagnostic"/>s.</param>
 /// <param name="compilation">Current <see cref="DefaultParamCompilationData"/>.</param>
 /// <param name="syntaxReceiver"><see cref="DefaultParamSyntaxReceiver"/> that collected the <see cref="DelegateDeclarationSyntax"/>es.</param>
 /// <param name="cache">Container of cached <see cref="DefaultParamDelegateData"/>s.</param>
 /// <param name="cancellationToken"><see cref="CancellationToken"/> that specifies if the operation should be canceled.</param>
 public static DefaultParamDelegateData[] GetValidDelegates(
     IDiagnosticReceiver diagnosticReceiver,
     DefaultParamCompilationData compilation,
     DefaultParamSyntaxReceiver syntaxReceiver,
     in CachedData <DefaultParamDelegateData> cache,