@@ -314,23 +314,19 @@ object Inliner {
314314 val source2 = SourceFile .virtual(" tasty-reflect" , code)
315315 inContext(ctx.fresh.setNewTyperState().setTyper(new Typer ).setSource(source2)) {
316316 val tree2 = new Parser (source2).block()
317- val res = collection.mutable.ListBuffer .empty[(ErrorKind , Error )]
318-
319- val parseErrors = ctx.reporter.allErrors.toList
320- res ++= parseErrors.map(e => ErrorKind .Parser -> e)
321- if res.isEmpty then
317+ if ctx.reporter.allErrors.nonEmpty then
318+ ctx.reporter.allErrors.map((ErrorKind .Parser , _))
319+ else
322320 val tree3 = ctx.typer.typed(tree2)
323321 ctx.base.postTyperPhase match
324- case postTyper : PostTyper =>
322+ case postTyper : PostTyper if ctx.reporter.allErrors.isEmpty =>
325323 val tree4 = atPhase(postTyper) { postTyper.newTransformer.transform(tree3) }
326324 ctx.base.inliningPhase match
327- case inlining : Inlining =>
328- val tree5 = atPhase(inlining) { inlining.newTransformer.transform(tree4) }
325+ case inlining : Inlining if ctx.reporter.allErrors.isEmpty =>
326+ atPhase(inlining) { inlining.newTransformer.transform(tree4) }
329327 case _ =>
330328 case _ =>
331- val typerErrors = ctx.reporter.allErrors.filterNot(parseErrors.contains)
332- res ++= typerErrors.map(e => ErrorKind .Typer -> e)
333- res.toList
329+ ctx.reporter.allErrors.map((ErrorKind .Typer , _))
334330 }
335331 case t =>
336332 report.error(em " argument to compileError must be a statically known String but was: $codeArg" , codeArg1.srcPos)
0 commit comments