@@ -2,11 +2,11 @@ package dotty.tools.scaladoc
22package snippets
33
44import dotty .tools .io
5- import dotty .tools .io .AbstractFile
5+ import dotty .tools .io .{ AbstractFile , VirtualFile }
66import dotty .tools .dotc .Driver
77import dotty .tools .dotc .core .Mode
88import dotty .tools .dotc .config .Settings .Setting .*
9- import dotty .tools .dotc .reporting .StoreReporter
9+ import dotty .tools .dotc .reporting .Reporter
1010import dotty .tools .dotc .util .{SourceFile , SourcePosition }
1111import dotty .tools .dotc .util .Spans .NoSpan
1212import java .nio .charset .StandardCharsets
@@ -23,8 +23,7 @@ class SnippetCompiler(
2323 ): SnippetCompilationResult =
2424 val driver = new SnippetDriver (snippetCompilerSettings, target)
2525 val files = List (new VirtualFile (" (snippet)" , wrappedSnippet.snippet.getBytes(StandardCharsets .UTF_8 )))
26- val reporter = driver.process(arg.scalacOptions, files)
27- reporter.flush()
26+ val reporter = driver.processFiles(arg.scalacOptions, files)
2827 val diagnostics = reporter.allErrors ++ reporter.allWarnings ++ reporter.allInfos
2928 val observed = SnippetExpectations .observe(diagnostics, wrappedSnippet, sourceFile)
3029
@@ -72,10 +71,12 @@ final class SnippetDriver(snippetCompilerSettings: Seq[SnippetCompilerSetting[?]
7271 rootCtx.setSetting(scSetting.setting, scSetting.value)
7372 rootCtx.setSetting(rootCtx.settings.outputDir, target)
7473
75- def process (args : Array [String ], files : List [AbstractFile ]): Reporter = {
76- setup(args, initCtx.fresh) match
74+ def processFiles (args : Iterable [String ], files : List [AbstractFile ]): Reporter = {
75+ setup(args.toArray , initCtx.fresh) match
7776 case Some ((_, compileCtx)) =>
78- doCompile(newCompiler(using compileCtx), files)(using compileCtx)
77+ val reporter = doCompile(newCompiler(using compileCtx), files)(using compileCtx)
78+ reporter.flush()(using compileCtx)
79+ reporter
7980 case None =>
8081 initCtx.reporter
8182 }
0 commit comments