Pseudocode label now cannot be bound to a non-owning pseudocode #KT-13555 Fixed
Also EA-77641 Fixed (cherry picked from commit 07643ce)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
08f8a2b75c
commit
25eefdb6ec
@@ -192,6 +192,11 @@ class PseudocodeImpl(override val correspondingElement: KtElement) : Pseudocode
|
||||
}
|
||||
|
||||
fun bindLabel(label: PseudocodeLabel) {
|
||||
assert(this == label.pseudocode) {
|
||||
"Attempt to bind label $label to instruction from different pseudocode: " +
|
||||
"\nowner pseudocode = ${label.pseudocode.mutableInstructionList}, " +
|
||||
"\nbound pseudocode = ${this.mutableInstructionList}"
|
||||
}
|
||||
label.targetInstructionIndex = mutableInstructionList.size
|
||||
}
|
||||
|
||||
@@ -380,7 +385,7 @@ class PseudocodeImpl(override val correspondingElement: KtElement) : Pseudocode
|
||||
if (label === startLabel || label === finishLabel) continue
|
||||
|
||||
if (startIndex <= index && index <= finishIndex) {
|
||||
originalToCopy.put(label, label.copy(labelCount++))
|
||||
originalToCopy.put(label, label.copy(this, labelCount++))
|
||||
originalLabelsForInstruction.put(getJumpTarget(label), label)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class PseudocodeLabel internal constructor(
|
||||
return instructionList[index]
|
||||
}
|
||||
|
||||
fun copy(newLabelIndex: Int): PseudocodeLabel {
|
||||
return PseudocodeLabel(pseudocode, "L" + newLabelIndex, "copy of $name, $comment")
|
||||
fun copy(newPseudocode: PseudocodeImpl, newLabelIndex: Int): PseudocodeLabel {
|
||||
return PseudocodeLabel(newPseudocode, "L" + newLabelIndex, "copy of $name, $comment")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user