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:
Tuomas Tynkkynen
2014-02-06 09:56:51 -08:00
committed by Nikolay Krasko
parent 998d2c5ec8
commit 7a2321460d
8 changed files with 53 additions and 6 deletions
@@ -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;
}
}