More detailed error message for EA-77641

This commit is contained in:
Mikhail Glukhikh
2016-01-27 12:01:07 +03:00
parent 7c8cdf84fd
commit c5d6e8edb4
@@ -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 {