Exemplo n.º 1
0
        private static void AnalyzeDacField(DacFieldInfo dacFieldInfo, SymbolAnalysisContext symbolContext, PXContext pxContext)
        {
            symbolContext.CancellationToken.ThrowIfCancellationRequested();

            if (dacFieldInfo.Symbol.IsAbstract)
            {
                return;
            }

            symbolContext.ReportDiagnosticWithSuppressionCheck(
                Diagnostic.Create(Descriptors.PX1024_DacNonAbstractFieldType, dacFieldInfo.Node.Identifier.GetLocation()),
                pxContext.CodeAnalysisSettings);
        }
Exemplo n.º 2
0
        private List <SyntaxNode> MakeParameterNodesForFindMethod(SyntaxGenerator generator, PXContext pxContext,
                                                                  DacSemanticModel dacSemanticModel, List <DacPropertyInfo> dacKeys)
        {
            const string graphParameterName = "graph";
            var          graphParameter     = generator.ParameterDeclaration(graphParameterName,
                                                                             generator.TypeExpression(pxContext.PXGraph.Type));
            var parameters = new List <SyntaxNode>(capacity: dacKeys.Count + 1)
            {
                graphParameter
            };

            foreach (DacPropertyInfo keyProperty in dacKeys)
            {
                DacFieldInfo keyField      = dacSemanticModel.FieldsByNames[keyProperty.Name];
                var          parameterType = generator.TypeExpression(keyProperty.PropertyType);
                var          parameterNode = generator.ParameterDeclaration(keyField.Name, parameterType);

                parameters.Add(parameterNode);
            }

            return(parameters);
        }