public static async Task<CompilationUnitSyntax> GenerateEventSourceImplementations(Document document, FrameworkName targetFrameworkName, CancellationToken cancellationToken = default(CancellationToken)) { Compilation compilation = await document.Project.GetCompilationAsync(cancellationToken); SyntaxTree syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken); CompilationUnitSyntax root = await document.GetCompilationUnitRootAsync(cancellationToken); SemanticModel semanticModel = compilation.GetSemanticModel(syntaxTree); EventSourceGenerator generator = new EventSourceGenerator(document, compilation, syntaxTree, root, semanticModel, targetFrameworkName); return generator.Generate(); }