public CompilationExpander(CSharpCompilation compilation, SourceFileContainer sourceFileContainer, ExpandConfig config)
        {
            this.sourceFileContainer = sourceFileContainer;
            var specificDiagnosticOptionsBuilder = ImmutableDictionary.CreateBuilder <string, ReportDiagnostic>();

            specificDiagnosticOptionsBuilder.Add("CS8019", ReportDiagnostic.Error);
            specificDiagnosticOptionsBuilder.Add("CS0105", ReportDiagnostic.Error);
            var opts = compilation.Options
                       .WithSpecificDiagnosticOptions(specificDiagnosticOptionsBuilder.ToImmutable());

            Compilation = compilation.WithOptions(opts);
            Config      = config;
        }
Ejemplo n.º 2
0
 public EmbeddedLoader(
     CSharpCompilation compilation,
     CSharpParseOptions parseOptions,
     IDiagnosticReporter reporter,
     ExpandConfig config,
     CancellationToken cancellationToken = default)
 {
     this.reporter = reporter;
     this.compilation = compilation;
     this.ConcurrentBuild = compilation.Options.ConcurrentBuild;
     this.parseOptions = parseOptions.WithDocumentationMode(DocumentationMode.Diagnose);
     this.config = config;
     this.cancellationToken = cancellationToken;
     var embeddedDatas = new AssemblyMetadataResolver(compilation).GetEmbeddedSourceFiles(cancellationToken);
     container = new SourceFileContainer(WithCheck(embeddedDatas));
 }