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
|
||||
// Note, that calls happen in order of DFS-exit, so deeper nodes are applied earlier
|
||||
inline fun <reified T : JetElement> forEachDescendantOfTypeVisitor(
|
||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) block: (T) -> Unit
|
||||
noinline block: (T) -> Unit
|
||||
): JetVisitorVoid =
|
||||
object : JetTreeVisitorVoid() {
|
||||
override fun visitJetElement(element: JetElement) {
|
||||
@@ -529,5 +529,5 @@ inline fun <reified T : JetElement> forEachDescendantOfTypeVisitor(
|
||||
|
||||
inline fun <reified T : JetElement, R> flatMapDescendantsOfTypeVisitor(
|
||||
accumulator: MutableCollection<R>,
|
||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) map: (T) -> Collection<R>
|
||||
noinline map: (T) -> Collection<R>
|
||||
): JetVisitorVoid = forEachDescendantOfTypeVisitor<T> { accumulator.addAll(map(it)) }
|
||||
|
||||
@@ -128,8 +128,8 @@ class JetWholeProjectForEachElementOfTypeFix<T> private (
|
||||
|
||||
companion object {
|
||||
inline fun <reified E : JetElement> createByPredicate(
|
||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) predicate: (E) -> Boolean,
|
||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) taskProcessor: (E) -> Unit,
|
||||
noinline predicate: (E) -> Boolean,
|
||||
noinline taskProcessor: (E) -> Unit,
|
||||
modalTitle: String,
|
||||
name: String,
|
||||
familyName: String
|
||||
@@ -142,8 +142,8 @@ class JetWholeProjectForEachElementOfTypeFix<T> private (
|
||||
)
|
||||
|
||||
inline fun <reified E : JetElement, D : Any> createByTaskFactory(
|
||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) taskFactory: (E) -> D?,
|
||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) taskProcessor: (D) -> Unit,
|
||||
noinline taskFactory: (E) -> D?,
|
||||
noinline taskProcessor: (D) -> Unit,
|
||||
modalTitle: String,
|
||||
name: String,
|
||||
familyName: String
|
||||
@@ -156,7 +156,7 @@ class JetWholeProjectForEachElementOfTypeFix<T> private (
|
||||
)
|
||||
|
||||
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,
|
||||
modalTitle: String,
|
||||
name: String,
|
||||
|
||||
@@ -28,8 +28,8 @@ inline fun <reified T : PsiElement> Diagnostic.createIntentionForFirstParentOfTy
|
||||
) = getPsiElement().getNonStrictParentOfType<T>()?.let(factory)
|
||||
|
||||
|
||||
inline fun createIntentionFactory(
|
||||
inlineOptions(InlineOption.ONLY_LOCAL_RETURN) factory: (Diagnostic) -> IntentionAction?
|
||||
fun createIntentionFactory(
|
||||
factory: (Diagnostic) -> IntentionAction?
|
||||
) = object : JetSingleIntentionActionFactory() {
|
||||
override fun createAction(diagnostic: Diagnostic) = factory(diagnostic)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user