void DoGenerateCode(
            CodeGenerationContext context,
            ClassProcessor classProcessor,
            CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            if (context.EmitDiagnostics(classProcessor.GetErrors()))
            {
                return;
            }
            cancellationToken.ThrowIfCancellationRequested();
            context.EmitDiagnostics(classProcessor.GetWarnings());
            var text = classProcessor.DoGenerate();

            if (context.CompilationContext.IsTagExits(classProcessor.FileName) == false)
            {
                context.AddSource(classProcessor.FileName, text);
                context.CompilationContext.AddTag(classProcessor.FileName);
                if (classProcessor.IsUpdateCompilationRequired)
                {
                    context.CompilationContext.AddSyntaxTree(CSharpSyntaxTree.ParseText(
                                                                 text, context.ParseOptions, cancellationToken: cancellationToken));
                }
            }
            cancellationToken.ThrowIfCancellationRequested();
        }
        private static void DoGenerateInvocation(
            CodeGenerationContext context,
            IMethodSymbol methodSymbol,
            InvocationExpressionSyntax candidateInvocation,
            CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            ExpressionRewriter processor;

            switch (methodSymbol.Name)
            {
            case nameof(AbstractMockNameofProvider.ArrangeSetter):
                processor = new ArrangeExpressionRewriter(methodSymbol, candidateInvocation, context.Compilation);
                break;

            case nameof(AbstractMockNameofProvider.AssertSet):
                processor = new AssertExpressionRewriter(methodSymbol, candidateInvocation, context.Compilation);
                break;

            default:
                return;
            }

            cancellationToken.ThrowIfCancellationRequested();
            if (context.CompilationContext.IsTagExits(processor.FileName))
            {
                context.ReportDiagnostic(Diagnostic.Create(
                                             DiagnosticsDescriptors.KPropertyExpressionMustHaveUniqueId,
                                             candidateInvocation.GetLocation(), methodSymbol.Name));
                return;
            }
            if (context.EmitDiagnostics(processor.GetErrors()))
            {
                return;
            }
            cancellationToken.ThrowIfCancellationRequested();
            context.EmitDiagnostics(processor.GetWarnings());
            cancellationToken.ThrowIfCancellationRequested();
            var text = processor.DoGenerate();

            context.AddSource(processor.FileName, text);
            context.CompilationContext.AddTag(processor.FileName);
        }