[JVM] Validate lowered JVM IR only if it was explicitly requested
This is an addition to the f5bb477459
commit. Earlier, some of the validation checks were moved from
`stickyPostconditions` into separate lowering. But these
post-conditions checks were launched only when several flags were
set to true. In this commit, we just return to such behavior.
#KT-64116
This commit is contained in:
+1
-1
@@ -82,7 +82,7 @@ private val validateIrAfterLowering = makeCustomPhase(
|
|||||||
)
|
)
|
||||||
|
|
||||||
private val validateJvmIrAfterLowering = makeCustomPhase<JvmBackendContext>(
|
private val validateJvmIrAfterLowering = makeCustomPhase<JvmBackendContext>(
|
||||||
{ _, module -> validateJvmIr(module) },
|
{ context, module -> validateJvmIr(context, module) },
|
||||||
name = "ValidateJvmIrAfterLowering",
|
name = "ValidateJvmIrAfterLowering",
|
||||||
description = "Validate that IR after lowering is correctly structured by Kotlin JVM rules"
|
description = "Validate that IR after lowering is correctly structured by Kotlin JVM rules"
|
||||||
)
|
)
|
||||||
|
|||||||
+3
-1
@@ -27,7 +27,9 @@ private fun checkAllFileLevelDeclarationsAreClasses(module: IrModuleFragment) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun validateJvmIr(module: IrModuleFragment) {
|
fun validateJvmIr(context: JvmBackendContext, module: IrModuleFragment) {
|
||||||
|
if (!context.config.shouldValidateIr) return
|
||||||
|
|
||||||
checkAllFileLevelDeclarationsAreClasses(module)
|
checkAllFileLevelDeclarationsAreClasses(module)
|
||||||
val validator = object : IrElementVisitorVoid {
|
val validator = object : IrElementVisitorVoid {
|
||||||
override fun visitElement(element: IrElement) {
|
override fun visitElement(element: IrElement) {
|
||||||
|
|||||||
Reference in New Issue
Block a user