From c5d6e8edb464c2e6871ce782540503d630c19516 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 27 Jan 2016 12:01:07 +0300 Subject: [PATCH] More detailed error message for EA-77641 --- .../org/jetbrains/kotlin/cfg/pseudocode/PseudocodeImpl.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/PseudocodeImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/PseudocodeImpl.kt index 1c3cc009daa..c4856c5f84f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/PseudocodeImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/PseudocodeImpl.kt @@ -58,8 +58,12 @@ class PseudocodeImpl(override val correspondingElement: KtElement) : Pseudocode } fun resolveToInstruction(): Instruction { - assert(targetInstructionIndex != null) - return mutableInstructionList[targetInstructionIndex!!] + val index = targetInstructionIndex + if (index == null || index >= mutableInstructionList.size) { + error("resolveToInstruction: incorrect index $index for label $name " + + "in subroutine ${correspondingElement.text} with instructions $mutableInstructionList") + } + return mutableInstructionList[index] } fun copy(newLabelIndex: Int): PseudocodeLabel {