Quickfix to add a loop label when 'break' or 'continue' is used in a loop inside 'when'
#KT-7202 Fixed
This commit is contained in:
@@ -321,6 +321,9 @@ public class JetPsiFactory(private val project: Project) {
|
||||
return (createExpression("this@" + labelName) as JetThisExpression).getTargetLabel()!!
|
||||
}
|
||||
|
||||
public fun createLabeledExpression(labelName: String): JetLabeledExpression
|
||||
= createExpression("$labelName@ 1") as JetLabeledExpression
|
||||
|
||||
public fun createFieldIdentifier(fieldName: String): JetExpression {
|
||||
return createExpression("$" + fieldName)
|
||||
}
|
||||
|
||||
@@ -562,6 +562,8 @@ public class JetPsiUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (parentExpression instanceof JetLabeledExpression) return false;
|
||||
|
||||
// 'x ?: ...' case
|
||||
if (parentExpression instanceof JetBinaryExpression && parentOperation == JetTokens.ELVIS && currentInner == ((JetBinaryExpression) parentExpression).getRight()) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user