mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
exception from refactoring in IDEA-80181
This commit is contained in:
+7
-2
@@ -755,8 +755,13 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
|
||||
if (parent instanceof PsiClass) break;
|
||||
endElement = parent;
|
||||
}
|
||||
myElement.getParent().deleteChildRange(myElement, PsiTreeUtil.skipSiblingsBackward(endElement, PsiWhiteSpace.class));
|
||||
} else if (myDeleteSelf) {
|
||||
PsiElement last = PsiTreeUtil.skipSiblingsBackward(endElement, PsiWhiteSpace.class);
|
||||
if (last.getTextRange().getStartOffset() < myElement.getTextRange().getStartOffset()) {
|
||||
last = myElement;
|
||||
}
|
||||
myElement.getParent().deleteChildRange(myElement, last);
|
||||
}
|
||||
else if (myDeleteSelf) {
|
||||
myElement.getParent().delete();
|
||||
}
|
||||
|
||||
|
||||
@@ -154,6 +154,7 @@ public class CodeEditUtil {
|
||||
if (child == last) break;
|
||||
child = child.getTreeNext();
|
||||
}
|
||||
assert child == last : last + " is not a successor of " + first +" in the .getTreeNext() chain";
|
||||
|
||||
final ASTNode prevLeaf = TreeUtil.prevLeaf(first);
|
||||
final ASTNode nextLeaf = TreeUtil.nextLeaf(first);
|
||||
|
||||
@@ -354,6 +354,11 @@ public abstract class TreeElement extends ElementBase implements ASTNode, Clonea
|
||||
|
||||
assert end == null || end.getTreeParent() == parent : "Trying to remove non-child";
|
||||
|
||||
if (end != null) {
|
||||
TreeElement element;
|
||||
for (element = this; element != end && element != null; element = element.getTreeNext());
|
||||
assert element == end : end + " is not successor of " + this +" in the .getTreeNext() chain";
|
||||
}
|
||||
if (parent != null){
|
||||
if (this == parent.getFirstChildNode()) {
|
||||
parent.setFirstChildNode(end);
|
||||
|
||||
Reference in New Issue
Block a user