Prevent expression selector from selecting just a label
Previously, extract variable could act on e.g. 'break@outerLoop' and extract the label, leading into nonsensical 'val x = @outerLoop'. Prevent JetRefactoringUtil.selectExpression from returning label expressions to fix this. #KT-4515 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
998d2c5ec8
commit
7a2321460d
@@ -1042,4 +1042,9 @@ public class JetPsiUtil {
|
||||
expression;
|
||||
return (JetToken) elementType;
|
||||
}
|
||||
|
||||
public static boolean isLabelIdentifierExpression(PsiElement element) {
|
||||
return element instanceof JetSimpleNameExpression &&
|
||||
((JetSimpleNameExpression) element).getReferencedNameElementType() == JetTokens.LABEL_IDENTIFIER;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user