public static IEnumerable <GeneratedSourceText> GetGeneratedSourceTexts(this GeneratorExecutionContext context) { var additionalSources = context.ToDynamic()._additionalSources._sourcesAdded as DynamicBinder; var sourcesAdded = additionalSources !.Object.IsInstanceOf <IEnumerable>().Cast <object>(); foreach (var source in sourcesAdded) { var hintName = (string)source.ToDynamic().HintName; var sourceText = (SourceText)source.ToDynamic().Text; yield return(new GeneratedSourceText(hintName, sourceText)); } }
public static IEnumerable <Diagnostic> GetDiagnostics(this GeneratorExecutionContext context) { var diagnosticsBag = (ConcurrentQueue <Diagnostic>)context.ToDynamic()._diagnostics.Bag; return(diagnosticsBag); }