Exemplo n.º 1
0
        /// <summary>
        /// Set the method conversion to Ignore for all method data that are inside the given document and can not be
        /// converted due to the language limitations or an already existing async counterpart.
        /// </summary>
        /// <param name="documentData">The document data to be pre-analyzed</param>
        private void PreAnalyzeDocumentData(DocumentData documentData)
        {
            foreach (var typeNode in documentData.Node
                     .DescendantNodes()
                     .OfType <TypeDeclarationSyntax>())
            {
                var typeData = documentData.GetOrCreateTypeData(typeNode);
                typeData.Conversion = _configuration.TypeConversionFunction(typeData.Symbol);
                PreAnalyzeType(typeData);

                foreach (var methodNode in typeNode
                         .DescendantNodes()
                         .OfType <MethodDeclarationSyntax>())
                {
                    var methodData = documentData.GetOrCreateMethodData(methodNode, typeData);
                    if (typeData.Conversion == TypeConversion.Ignore)
                    {
                        methodData.Conversion = MethodConversion.Ignore;
                    }
                    else
                    {
                        PreAnalyzeMethodData(methodData);
                    }

                    foreach (var funNode in methodNode
                             .DescendantNodes()
                             .OfType <AnonymousFunctionExpressionSyntax>())
                    {
                        var funData = documentData.GetOrCreateAnonymousFunctionData(funNode, methodData);
                        if (typeData.Conversion == TypeConversion.Ignore)
                        {
                            methodData.Conversion = MethodConversion.Ignore;
                        }
                        else
                        {
                            PreAnalyzeAnonymousFunction(funData, documentData.SemanticModel);
                        }
                    }
                }
            }
        }