Create From Usage: Do not suggest "val" for references used as assignment left-hand side

This commit is contained in:
Alexey Sedunov
2014-10-03 16:38:38 +04:00
parent 58126b28ca
commit 865c793561
26 changed files with 180 additions and 49 deletions
@@ -345,4 +345,9 @@ public fun PsiElement.siblings(forward: Boolean = true, withItself: Boolean = tr
public fun PsiElement.parents(withItself: Boolean = true): Stream<PsiElement> {
val stream = stream(this) { if (it is PsiFile) null else it.getParent() }
return if (withItself) stream else stream.drop(1)
}
public fun JetExpression.getAssignmentByLHS(): JetBinaryExpression? {
val parent = getParent() as? JetBinaryExpression ?: return null
return if (JetPsiUtil.isAssignment(parent) && parent.getLeft() == this) parent else null
}