From 28406b6bc44f6d1b4a9c9da948e3079b2bcdb018 Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Mon, 13 May 2019 16:07:10 +0300 Subject: [PATCH] [JS IR BE] Enable unconditional validation --- .../kotlin/ir/backend/js/JsLoweringPhases.kt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt index 0fe0ee8c677..b3a72f73ccd 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt @@ -66,6 +66,18 @@ private fun makeCustomJsModulePhase( } ) +private val validateIrBeforeLowering = makeCustomJsModulePhase( + { context, module -> validationCallback(context, module) }, + name = "ValidateIrBeforeLowering", + description = "Validate IR before lowering" +) + +private val validateIrAfterLowering = makeCustomJsModulePhase( + { context, module -> validationCallback(context, module) }, + name = "ValidateIrAfterLowering", + description = "Validate IR after lowering" +) + private val moveBodilessDeclarationsToSeparatePlacePhase = makeCustomJsModulePhase( { context, module -> moveBodilessDeclarationsToSeparatePlace(context, module) @@ -357,7 +369,8 @@ private val staticMembersLoweringPhase = makeJsModulePhase( val jsPhases = namedIrModulePhase( name = "IrModuleLowering", description = "IR module lowering", - lower = testGenerationPhase then + lower = validateIrBeforeLowering then + testGenerationPhase then expectDeclarationsRemovingPhase then arrayConstructorPhase then functionInliningPhase then @@ -399,5 +412,6 @@ val jsPhases = namedIrModulePhase( primitiveCompanionLoweringPhase then constLoweringPhase then callsLoweringPhase then - staticMembersLoweringPhase + staticMembersLoweringPhase then + validateIrAfterLowering )