PseudocodeLabel: add slightly better exception diagnostics
This commit is contained in:
committed by
Mikhail Glukhikh
parent
9a5b5393f5
commit
ab0e734e7d
@@ -34,11 +34,16 @@ class PseudocodeLabel internal constructor(
|
||||
|
||||
override fun resolveToInstruction(): Instruction {
|
||||
val index = targetInstructionIndex
|
||||
if (index < 0 || index >= instructionList.size) {
|
||||
error("resolveToInstruction: incorrect index $index for label $name " +
|
||||
"in subroutine ${correspondingElement.text} with instructions $instructionList")
|
||||
when {
|
||||
index < 0 ->
|
||||
error("resolveToInstruction: unbound label $name " +
|
||||
"in subroutine ${correspondingElement.text} with instructions $instructionList")
|
||||
index >= instructionList.size ->
|
||||
error("resolveToInstruction: incorrect index $index for label $name " +
|
||||
"in subroutine ${correspondingElement.text} with instructions $instructionList")
|
||||
else ->
|
||||
return instructionList[index]
|
||||
}
|
||||
return instructionList[index]
|
||||
}
|
||||
|
||||
fun copy(newPseudocode: PseudocodeImpl, newLabelIndex: Int): PseudocodeLabel =
|
||||
|
||||
Reference in New Issue
Block a user