Add workaround for KT-7544
Inlining lambdas into objects or non-inlineable lambdas does not work well. Should be reverted after issue will be fixed
This commit is contained in:
@@ -516,7 +516,7 @@ public fun PsiElement.getElementTextWithContext(): String {
|
|||||||
// Calls `block` on each descendant of T type
|
// Calls `block` on each descendant of T type
|
||||||
// Note, that calls happen in order of DFS-exit, so deeper nodes are applied earlier
|
// Note, that calls happen in order of DFS-exit, so deeper nodes are applied earlier
|
||||||
inline fun <reified T : JetElement> forEachDescendantOfTypeVisitor(
|
inline fun <reified T : JetElement> forEachDescendantOfTypeVisitor(
|
||||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) block: (T) -> Unit
|
noinline block: (T) -> Unit
|
||||||
): JetVisitorVoid =
|
): JetVisitorVoid =
|
||||||
object : JetTreeVisitorVoid() {
|
object : JetTreeVisitorVoid() {
|
||||||
override fun visitJetElement(element: JetElement) {
|
override fun visitJetElement(element: JetElement) {
|
||||||
@@ -529,5 +529,5 @@ inline fun <reified T : JetElement> forEachDescendantOfTypeVisitor(
|
|||||||
|
|
||||||
inline fun <reified T : JetElement, R> flatMapDescendantsOfTypeVisitor(
|
inline fun <reified T : JetElement, R> flatMapDescendantsOfTypeVisitor(
|
||||||
accumulator: MutableCollection<R>,
|
accumulator: MutableCollection<R>,
|
||||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) map: (T) -> Collection<R>
|
noinline map: (T) -> Collection<R>
|
||||||
): JetVisitorVoid = forEachDescendantOfTypeVisitor<T> { accumulator.addAll(map(it)) }
|
): JetVisitorVoid = forEachDescendantOfTypeVisitor<T> { accumulator.addAll(map(it)) }
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ class JetWholeProjectForEachElementOfTypeFix<T> private (
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
inline fun <reified E : JetElement> createByPredicate(
|
inline fun <reified E : JetElement> createByPredicate(
|
||||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) predicate: (E) -> Boolean,
|
noinline predicate: (E) -> Boolean,
|
||||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) taskProcessor: (E) -> Unit,
|
noinline taskProcessor: (E) -> Unit,
|
||||||
modalTitle: String,
|
modalTitle: String,
|
||||||
name: String,
|
name: String,
|
||||||
familyName: String
|
familyName: String
|
||||||
@@ -142,8 +142,8 @@ class JetWholeProjectForEachElementOfTypeFix<T> private (
|
|||||||
)
|
)
|
||||||
|
|
||||||
inline fun <reified E : JetElement, D : Any> createByTaskFactory(
|
inline fun <reified E : JetElement, D : Any> createByTaskFactory(
|
||||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) taskFactory: (E) -> D?,
|
noinline taskFactory: (E) -> D?,
|
||||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) taskProcessor: (D) -> Unit,
|
noinline taskProcessor: (D) -> Unit,
|
||||||
modalTitle: String,
|
modalTitle: String,
|
||||||
name: String,
|
name: String,
|
||||||
familyName: String
|
familyName: String
|
||||||
@@ -156,7 +156,7 @@ class JetWholeProjectForEachElementOfTypeFix<T> private (
|
|||||||
)
|
)
|
||||||
|
|
||||||
inline fun <reified E : JetElement, D> createForMultiTask(
|
inline fun <reified E : JetElement, D> createForMultiTask(
|
||||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) tasksFactory: (E) -> Collection<D>,
|
noinline tasksFactory: (E) -> Collection<D>,
|
||||||
noinline tasksProcessor: (Collection<D>) -> Unit,
|
noinline tasksProcessor: (Collection<D>) -> Unit,
|
||||||
modalTitle: String,
|
modalTitle: String,
|
||||||
name: String,
|
name: String,
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ inline fun <reified T : PsiElement> Diagnostic.createIntentionForFirstParentOfTy
|
|||||||
) = getPsiElement().getNonStrictParentOfType<T>()?.let(factory)
|
) = getPsiElement().getNonStrictParentOfType<T>()?.let(factory)
|
||||||
|
|
||||||
|
|
||||||
inline fun createIntentionFactory(
|
fun createIntentionFactory(
|
||||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) factory: (Diagnostic) -> IntentionAction?
|
factory: (Diagnostic) -> IntentionAction?
|
||||||
) = object : JetSingleIntentionActionFactory() {
|
) = object : JetSingleIntentionActionFactory() {
|
||||||
override fun createAction(diagnostic: Diagnostic) = factory(diagnostic)
|
override fun createAction(diagnostic: Diagnostic) = factory(diagnostic)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user