Move: Fix element listener retrieval
Get element listener before original declaration is invalidated by the refactoring
This commit is contained in:
+3
-1
@@ -260,6 +260,8 @@ class MoveKotlinDeclarationsProcessor(
|
|||||||
)
|
)
|
||||||
for ((sourceFile, kotlinToLightElements) in kotlinToLightElementsBySourceFile) {
|
for ((sourceFile, kotlinToLightElements) in kotlinToLightElementsBySourceFile) {
|
||||||
for ((oldDeclaration, oldLightElements) in kotlinToLightElements) {
|
for ((oldDeclaration, oldLightElements) in kotlinToLightElements) {
|
||||||
|
val elementListener = transaction!!.getElementListener(oldDeclaration)
|
||||||
|
|
||||||
val newDeclaration = moveDeclaration(oldDeclaration, descriptor.moveTarget)
|
val newDeclaration = moveDeclaration(oldDeclaration, descriptor.moveTarget)
|
||||||
if (newDeclaration == null) {
|
if (newDeclaration == null) {
|
||||||
for (oldElement in oldLightElements) {
|
for (oldElement in oldLightElements) {
|
||||||
@@ -270,7 +272,7 @@ class MoveKotlinDeclarationsProcessor(
|
|||||||
|
|
||||||
oldToNewElementsMapping[sourceFile] = newDeclaration.containingKtFile
|
oldToNewElementsMapping[sourceFile] = newDeclaration.containingKtFile
|
||||||
|
|
||||||
transaction!!.getElementListener(oldDeclaration).elementMoved(newDeclaration)
|
elementListener.elementMoved(newDeclaration)
|
||||||
for ((oldElement, newElement) in oldLightElements.asSequence().zip(newDeclaration.toLightElements().asSequence())) {
|
for ((oldElement, newElement) in oldLightElements.asSequence().zip(newDeclaration.toLightElements().asSequence())) {
|
||||||
oldToNewElementsMapping[oldElement] = newElement
|
oldToNewElementsMapping[oldElement] = newElement
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user