[FIR CLI] Don't run generation if some errors are found

This commit is contained in:
Mikhail Glukhikh
2020-08-19 15:53:37 +03:00
parent 85c1505689
commit 07bddbe4d0
@@ -370,7 +370,7 @@ object KotlinToJVMBytecodeCompiler {
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, stubMode = false) val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, stubMode = false)
val resolveTransformer = FirTotalResolveProcessor(session) val resolveTransformer = FirTotalResolveProcessor(session)
val collector = FirDiagnosticsCollector.create(session) val collector = FirDiagnosticsCollector.create(session)
val diagnostics = mutableListOf<FirDiagnostic<*>>() val firDiagnostics = mutableListOf<FirDiagnostic<*>>()
val firFiles = ktFiles.map { val firFiles = ktFiles.map {
val firFile = builder.buildFirFile(it) val firFile = builder.buildFirFile(it)
firProvider.recordFile(firFile) firProvider.recordFile(firFile)
@@ -379,7 +379,7 @@ object KotlinToJVMBytecodeCompiler {
try { try {
resolveTransformer.process(firFiles) resolveTransformer.process(firFiles)
firFiles.forEach { firFiles.forEach {
diagnostics += collector.collectDiagnostics(it) firDiagnostics += collector.collectDiagnostics(it)
} }
} catch (e: Exception) { } catch (e: Exception) {
throw e throw e
@@ -387,13 +387,16 @@ object KotlinToJVMBytecodeCompiler {
} }
AnalyzerWithCompilerReport.reportDiagnostics( AnalyzerWithCompilerReport.reportDiagnostics(
SimpleDiagnostics( SimpleDiagnostics(
diagnostics.map { it.toRegularDiagnostic() } firDiagnostics.map { it.toRegularDiagnostic() }
), ),
environment.messageCollector environment.messageCollector
) )
performanceManager?.notifyAnalysisFinished() performanceManager?.notifyAnalysisFinished()
if (firDiagnostics.any { it.severity == Severity.ERROR }) {
return false
}
performanceManager?.notifyGenerationStarted() performanceManager?.notifyGenerationStarted()
val signaturer = IdSignatureDescriptor(JvmManglerDesc()) val signaturer = IdSignatureDescriptor(JvmManglerDesc())