"move assignment to initializer" quickfix for assigning to properties in constructors/init blocks

This commit is contained in:
Dmitry Jemerov
2015-09-24 19:39:54 +02:00
parent e1acc8744d
commit 4e7236529c
18 changed files with 226 additions and 16 deletions
@@ -185,12 +185,11 @@ public inline fun <reified T : PsiElement> PsiElement.findDescendantOfType(noinl
public inline fun <reified T : PsiElement> PsiElement.findDescendantOfType(crossinline canGoInside: (PsiElement) -> Boolean, noinline predicate: (T) -> Boolean = { true }): T? {
var result: T? = null
this.accept(object : PsiRecursiveElementVisitor() {
this.accept(object : PsiRecursiveElementWalkingVisitor() {
override fun visitElement(element: PsiElement) {
if (result != null) return
if (element is T && predicate(element)) {
result = element
stopWalking()
return
}
@@ -310,4 +309,11 @@ public fun PsiElement.getTextWithLocation(): String = "'${this.getText()}' at ${
public fun SearchScope.contains(element: PsiElement): Boolean = PsiSearchScopeUtil.isInScope(this, element)
public fun <E : PsiElement> E.createSmartPointer(): SmartPsiElementPointer<E> =
SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(this)
SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(this)
fun PsiElement.resolveAllReferences(): Sequence<PsiElement?> {
return PsiReferenceService.getService().getReferences(this, PsiReferenceService.Hints.NO_HINTS)
.asSequence()
.map { it.resolve() }
}