public MethodTransformerResult Transform(IMethodOrAccessorTransformationResult transformResult,
                                                 ITypeTransformationMetadata typeMetadata, INamespaceTransformationMetadata namespaceMetadata)
        {
            var methodResult = transformResult.AnalyzationResult;

            if (!methodResult.Conversion.HasFlag(MethodConversion.ToAsync))
            {
                return(MethodTransformerResult.Skip);
            }
            var methodNode = transformResult.Transformed;

            if (methodNode.GetFunctionBody() == null)
            {
                return(Update(methodNode, methodResult, namespaceMetadata));
            }
            if (methodResult.SplitTail || methodResult.PreserveReturnType || !methodResult.OmitAsync)
            {
                if (!methodResult.OmitAsync)
                {
                    methodNode = methodNode.AddAsync();
                }
                return(Update(methodNode, methodResult, namespaceMetadata));
            }
            var rewriter = new ReturnTaskFunctionRewriter(transformResult, namespaceMetadata);

            methodNode = (MethodDeclarationSyntax)rewriter.VisitMethodDeclaration(methodNode);
            return(Update(methodNode, methodResult, namespaceMetadata));
        }
        public SyntaxNode Transform(IFunctionTransformationResult transformResult, ITypeTransformationMetadata typeMetadata,
                                    INamespaceTransformationMetadata namespaceMetadata)
        {
            var methodResult = transformResult.AnalyzationResult;

            if (!methodResult.Conversion.HasFlag(MethodConversion.ToAsync))
            {
                return(null);
            }
            var functionNode = transformResult.Transformed;

            if (functionNode.GetFunctionBody() == null)
            {
                return(Update(functionNode, methodResult, namespaceMetadata));
            }
            if (methodResult.SplitTail || methodResult.PreserveReturnType || !methodResult.OmitAsync)
            {
                if (!methodResult.OmitAsync)
                {
                    functionNode = functionNode.AddAsync();
                }
                return(Update(functionNode, methodResult, namespaceMetadata));
            }
            var rewriter = new ReturnTaskFunctionRewriter(transformResult, namespaceMetadata);

            functionNode = rewriter.Visit(functionNode);
            return(Update(functionNode, methodResult, namespaceMetadata));
        }