コード例 #1
0
            public ParametersCounterSymbolWalker(SyntaxNodeAnalysisContext aSyntaxContext, PXContext aPxContext)
            {
                syntaxContext     = aSyntaxContext;
                cancellationToken = syntaxContext.CancellationToken;

                isAcumatica2018R2 = aPxContext.IsAcumatica2018R2;

                if (isAcumatica2018R2)
                {
                    iViewConfig2018R2 = aPxContext.IViewConfig2018R2;
                }

                ParametersCounter = new ParametersCounter(aPxContext);
            }
コード例 #2
0
            public ParametersCounterSymbolWalker(SyntaxNodeAnalysisContext syntaxContext, PXContext pxContext)
            {
                _syntaxContext     = syntaxContext;
                _cancellationToken = _syntaxContext.CancellationToken;

                _isAcumatica2018R2 = pxContext.IsAcumatica2018R2;

                if (_isAcumatica2018R2)
                {
                    _iViewConfig2018R2 = pxContext.IViewConfig2018R2;
                }

                ParametersCounter = new ParametersCounter(pxContext);
            }
コード例 #3
0
        private static void VerifyBqlArgumentsCount(int argsCount, ParametersCounter parametersCounter, SyntaxNodeAnalysisContext syntaxContext,
                                                    InvocationExpressionSyntax invocation, IMethodSymbol methodSymbol, PXContext pxContext)
        {
            syntaxContext.CancellationToken.ThrowIfCancellationRequested();

            if (!parametersCounter.IsCountingValid)
            {
                return;
            }

            int searchMethodParametersCount = 0;

            if (methodSymbol.Name == SearchMethodName && methodSymbol.IsGenericMethod)
            {
                searchMethodParametersCount = methodSymbol.TypeParameters.Length;
            }

            int maxCount = parametersCounter.OptionalParametersCount + parametersCounter.RequiredParametersCount + searchMethodParametersCount;
            int minCount = parametersCounter.RequiredParametersCount + searchMethodParametersCount;

            if (argsCount < minCount || argsCount > maxCount)
            {
                Location location = invocation.GetMethodNameLocation();

                if (parametersCounter.OptionalParametersCount == 0)
                {
                    syntaxContext.ReportDiagnosticWithSuppressionCheck(Diagnostic.Create(
                                                                           Descriptors.PX1015_PXBqlParametersMismatchWithOnlyRequiredParams,
                                                                           location, methodSymbol.Name, minCount), pxContext.CodeAnalysisSettings);
                }
                else
                {
                    syntaxContext.ReportDiagnosticWithSuppressionCheck(Diagnostic.Create(
                                                                           Descriptors.PX1015_PXBqlParametersMismatchWithRequiredAndOptionalParams,
                                                                           location, methodSymbol.Name, minCount, maxCount), pxContext.CodeAnalysisSettings);
                }
            }
        }
コード例 #4
0
 public ParametersCounterSyntaxWalker(SyntaxNodeAnalysisContext aSyntaxContext, PXContext aPxContext)
 {
     syntaxContext     = aSyntaxContext;
     cancellationToken = syntaxContext.CancellationToken;
     ParametersCounter = new ParametersCounter(aPxContext);
 }