mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
IDEA-314469: lower JVM target level for *intellij.platform.uast*
GitOrigin-RevId: 9aa9245395c5d5b38b2b20b43ad12d0f7139506f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d13d21509c
commit
1bc9e3ae55
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@@ -915,6 +915,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/tracing-ide/intellij.platform.tracing.ide.iml" filepath="$PROJECT_DIR$/platform/tracing-ide/intellij.platform.tracing.ide.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/tracing/intellij.platform.tracing.rt.iml" filepath="$PROJECT_DIR$/platform/tracing/intellij.platform.tracing.rt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/uast/uast-common/intellij.platform.uast.iml" filepath="$PROJECT_DIR$/uast/uast-common/intellij.platform.uast.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/uast/uast-common-ide/intellij.platform.uast.ide.iml" filepath="$PROJECT_DIR$/uast/uast-common-ide/intellij.platform.uast.ide.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/uast/uast-tests/intellij.platform.uast.tests.iml" filepath="$PROJECT_DIR$/uast/uast-tests/intellij.platform.uast.tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/updater/intellij.platform.updater.iml" filepath="$PROJECT_DIR$/updater/intellij.platform.updater.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/usageView/intellij.platform.usageView.iml" filepath="$PROJECT_DIR$/platform/usageView/intellij.platform.usageView.iml" />
|
||||
|
||||
@@ -13,5 +13,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.uast" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.uast.ide" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -12,5 +12,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis" exported="" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.java.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.platform.uast.ide" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -49,7 +49,8 @@ object JavaPluginLayout {
|
||||
"intellij.java.psi",
|
||||
"intellij.java",
|
||||
"intellij.jsp",
|
||||
"intellij.platform.uast"
|
||||
"intellij.platform.uast",
|
||||
"intellij.platform.uast.ide",
|
||||
))
|
||||
|
||||
spec.withModules(listOf(
|
||||
|
||||
16
uast/uast-common-ide/intellij.platform.uast.ide.iml
Normal file
16
uast/uast-common-ide/intellij.platform.uast.ide.iml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.platform.lang" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.uast" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="library" name="StreamEx" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,14 +1,15 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:JvmName("UastPatterns")
|
||||
|
||||
package com.intellij.patterns.uast
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.patterns.*
|
||||
import com.intellij.patterns.ElementPattern
|
||||
import com.intellij.patterns.ObjectPattern
|
||||
import com.intellij.patterns.PatternCondition
|
||||
import com.intellij.patterns.PsiJavaPatterns.psiClass
|
||||
import com.intellij.patterns.PsiNamePatternCondition
|
||||
import com.intellij.patterns.StandardPatterns.string
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.util.ProcessingContext
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi
|
||||
|
||||
import com.intellij.codeInsight.AnnotationCacheOwnerNormalizer
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi
|
||||
|
||||
import com.intellij.util.ProcessingContext
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi
|
||||
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionUtilCoreImpl
|
||||
@@ -86,7 +86,8 @@ fun getReferencesForDirectUsagesOfVariable(element: PsiElement, targetHint: PsiE
|
||||
val uParentVariable = getUsageVariableTargetForInitializer(uElement) ?: return PsiReference.EMPTY_ARRAY
|
||||
|
||||
val registrar = ReferenceProvidersRegistry.getInstance().getRegistrar(Language.findLanguageByID("UAST")!!)
|
||||
val providerInfos = (registrar as PsiReferenceRegistrarImpl).getPairsByElement(originalElement, PsiReferenceService.Hints(targetHint, null))
|
||||
val providerInfos = (registrar as PsiReferenceRegistrarImpl).getPairsByElement(originalElement,
|
||||
PsiReferenceService.Hints(targetHint, null))
|
||||
|
||||
// by-usage providers must implement acceptsTarget correctly, we rely on fact that they accept targetHint
|
||||
val suitableProviders = providerInfos.asSequence()
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:JvmName("UastReferenceByUsageResolver")
|
||||
|
||||
package com.intellij.psi
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi
|
||||
|
||||
import com.intellij.util.ProcessingContext
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi
|
||||
|
||||
import com.intellij.openapi.progress.impl.CancellationCheck
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:JvmName("UastReferenceRegistrar")
|
||||
|
||||
package com.intellij.psi
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:JvmName("UastSemRegistrar")
|
||||
@file:ApiStatus.Experimental
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.analysis
|
||||
|
||||
import com.intellij.openapi.diagnostic.Attachment
|
||||
@@ -613,7 +613,7 @@ private class LocalScopeContext(
|
||||
fun createChild(isInlined: Boolean = false) = LocalScopeContext(this, inlinedId, isInlined)
|
||||
|
||||
fun setLastPotentialUpdate(variable: String, updateElement: UElement) {
|
||||
lastPotentialUpdatesOf[variable] = CandidatesTree.fromCandidate(
|
||||
lastPotentialUpdatesOf[variable] = Dependency.PotentialSideEffectDependency.CandidatesTree.fromCandidate(
|
||||
SideEffectChangeCandidate(
|
||||
updateElement,
|
||||
DependencyEvidence(),
|
||||
@@ -624,13 +624,15 @@ private class LocalScopeContext(
|
||||
val (evidence, witness) = evidenceAndWitness
|
||||
val newCandidate = SideEffectChangeCandidate(updateElement, evidence, witness)
|
||||
val candidatesForReference = lastPotentialUpdatesOf[reference]
|
||||
lastPotentialUpdatesOf[reference] = candidatesForReference?.addToBegin(newCandidate) ?: CandidatesTree.fromCandidate(newCandidate)
|
||||
lastPotentialUpdatesOf[reference] = candidatesForReference?.addToBegin(newCandidate)
|
||||
?: Dependency.PotentialSideEffectDependency.CandidatesTree.fromCandidate(
|
||||
newCandidate)
|
||||
}
|
||||
}
|
||||
|
||||
fun setLastPotentialUpdateAsAssignment(variable: String, updateElements: Collection<UElement>) {
|
||||
if (updateElements.size == 1) {
|
||||
lastPotentialUpdatesOf[variable] = CandidatesTree.fromCandidate(
|
||||
lastPotentialUpdatesOf[variable] = Dependency.PotentialSideEffectDependency.CandidatesTree.fromCandidate(
|
||||
SideEffectChangeCandidate(
|
||||
updateElements.first(),
|
||||
DependencyEvidence(),
|
||||
@@ -638,7 +640,7 @@ private class LocalScopeContext(
|
||||
)
|
||||
}
|
||||
else {
|
||||
lastPotentialUpdatesOf[variable] = CandidatesTree.fromCandidates(
|
||||
lastPotentialUpdatesOf[variable] = Dependency.PotentialSideEffectDependency.CandidatesTree.fromCandidates(
|
||||
updateElements.mapTo(mutableSetOf()) {
|
||||
SideEffectChangeCandidate(it, DependencyEvidence(), dependencyWitnessValues = referencesModel.getAllTargetsForReference(variable))
|
||||
}
|
||||
@@ -685,7 +687,7 @@ private class LocalScopeContext(
|
||||
}
|
||||
}
|
||||
}.takeUnless { it.isEmpty() }?.let { candidates ->
|
||||
lastPotentialUpdatesOf[variableName] = CandidatesTree.merge(candidates)
|
||||
lastPotentialUpdatesOf[variableName] = Dependency.PotentialSideEffectDependency.CandidatesTree.merge(candidates)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.analysis
|
||||
|
||||
import com.intellij.psi.PsiReference
|
||||
@@ -1,11 +1,14 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.analysis
|
||||
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.util.PartiallyKnownString
|
||||
import com.intellij.psi.util.StringEntry
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.uast.*
|
||||
import org.jetbrains.uast.UElement
|
||||
import org.jetbrains.uast.ULiteralExpression
|
||||
import org.jetbrains.uast.UPolyadicExpression
|
||||
import org.jetbrains.uast.UastBinaryOperator
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@ApiStatus.Experimental
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.analysis
|
||||
|
||||
import com.intellij.openapi.diagnostic.debug
|
||||
@@ -14,8 +14,6 @@ import com.intellij.psi.util.CachedValuesManager
|
||||
import com.intellij.psi.util.PsiModificationTracker
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.uast.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashSet
|
||||
|
||||
/**
|
||||
* Dependency graph of UElements in some scope.
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.analysis
|
||||
|
||||
import com.intellij.openapi.util.TextRange
|
||||
@@ -8,7 +8,10 @@ import com.intellij.patterns.uast.callExpression
|
||||
import com.intellij.psi.PsiMethod
|
||||
import com.intellij.psi.util.PartiallyKnownString
|
||||
import com.intellij.psi.util.StringEntry
|
||||
import org.jetbrains.uast.*
|
||||
import org.jetbrains.uast.UReferenceExpression
|
||||
import org.jetbrains.uast.USimpleNameReferenceExpression
|
||||
import org.jetbrains.uast.UThisExpression
|
||||
import org.jetbrains.uast.getQualifiedChain
|
||||
|
||||
object UStringBuilderEvaluator : BuilderLikeExpressionEvaluator<PartiallyKnownString> {
|
||||
override val buildMethod: ElementPattern<PsiMethod>
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.analysis
|
||||
|
||||
import com.intellij.openapi.util.UserDataHolderBase
|
||||
@@ -44,7 +44,7 @@ sealed class Dependency : UserDataHolderBase() {
|
||||
data class BranchingDependency(
|
||||
override val elements: Set<UElement>,
|
||||
override val referenceInfo: DependencyOfReference.ReferenceInfo? = null
|
||||
) : Dependency(), DependencyOfReference {
|
||||
) : Dependency(), DependencyOfReference {
|
||||
fun unwrapIfSingle(): Dependency =
|
||||
if (elements.size == 1) {
|
||||
CommonDependency(elements.single(), referenceInfo)
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.analysis
|
||||
|
||||
import org.jetbrains.uast.*
|
||||
@@ -38,34 +38,3 @@ private val UExpression.lastExpression: UExpression?
|
||||
if (expression is UYieldExpression) expression.expression else expression
|
||||
}
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
object KotlinExtensionConstants {
|
||||
const val STANDARD_CLASS = "kotlin.StandardKt__StandardKt"
|
||||
const val LET_METHOD = "let"
|
||||
const val ALSO_METHOD = "also"
|
||||
const val RUN_METHOD = "run"
|
||||
const val APPLY_METHOD = "apply"
|
||||
|
||||
const val LAMBDA_THIS_PARAMETER_NAME = "<this>"
|
||||
|
||||
fun isExtensionWithSideEffect(call: UCallExpression): Boolean =
|
||||
call.methodName == ALSO_METHOD || call.methodName == APPLY_METHOD
|
||||
|
||||
fun isLetOrRunCall(call: UCallExpression): Boolean =
|
||||
call
|
||||
.takeIf { it.methodName == LET_METHOD || it.methodName == RUN_METHOD }
|
||||
?.resolve()
|
||||
?.containingClass?.qualifiedName == STANDARD_CLASS
|
||||
|
||||
fun isAlsoOrApplyCall(call: UCallExpression): Boolean =
|
||||
call
|
||||
.takeIf { it.methodName == ALSO_METHOD || it.methodName == APPLY_METHOD }
|
||||
?.resolve()
|
||||
?.containingClass?.qualifiedName == STANDARD_CLASS
|
||||
|
||||
fun isExtensionFunctionToIgnore(call: UCallExpression): Boolean =
|
||||
call
|
||||
.takeIf { it.methodName == LET_METHOD || it.methodName == ALSO_METHOD || it.methodName == RUN_METHOD || it.methodName == APPLY_METHOD }
|
||||
?.resolve()
|
||||
?.containingClass?.qualifiedName == STANDARD_CLASS
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.analysis
|
||||
|
||||
import com.intellij.patterns.ElementPattern
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.expressions
|
||||
|
||||
import com.intellij.openapi.util.TextRange
|
||||
@@ -1,18 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="5" platform="JVM 11" allPlatforms="JVM [11]" useProjectSettings="false">
|
||||
<compilerSettings>
|
||||
<option name="additionalArguments" value="-Xjvm-default=all -opt-in=com.intellij.openapi.util.IntellijInternalApi" />
|
||||
</compilerSettings>
|
||||
<compilerArguments>
|
||||
<stringArguments>
|
||||
<stringArg name="jvmTarget" arg="11" />
|
||||
<stringArg name="apiVersion" arg="1.8" />
|
||||
<stringArg name="languageVersion" arg="1.8" />
|
||||
</stringArguments>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ex" />
|
||||
<orderEntry type="module" module-name="intellij.platform.lang" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
|
||||
<orderEntry type="library" name="StreamEx" level="project" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,36 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.uast.analysis
|
||||
|
||||
import org.jetbrains.uast.UCallExpression
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
object KotlinExtensionConstants {
|
||||
const val STANDARD_CLASS = "kotlin.StandardKt__StandardKt"
|
||||
const val LET_METHOD = "let"
|
||||
const val ALSO_METHOD = "also"
|
||||
const val RUN_METHOD = "run"
|
||||
const val APPLY_METHOD = "apply"
|
||||
|
||||
const val LAMBDA_THIS_PARAMETER_NAME = "<this>"
|
||||
|
||||
fun isExtensionWithSideEffect(call: UCallExpression): Boolean =
|
||||
call.methodName == ALSO_METHOD || call.methodName == APPLY_METHOD
|
||||
|
||||
fun isLetOrRunCall(call: UCallExpression): Boolean =
|
||||
call
|
||||
.takeIf { it.methodName == LET_METHOD || it.methodName == RUN_METHOD }
|
||||
?.resolve()
|
||||
?.containingClass?.qualifiedName == STANDARD_CLASS
|
||||
|
||||
fun isAlsoOrApplyCall(call: UCallExpression): Boolean =
|
||||
call
|
||||
.takeIf { it.methodName == ALSO_METHOD || it.methodName == APPLY_METHOD }
|
||||
?.resolve()
|
||||
?.containingClass?.qualifiedName == STANDARD_CLASS
|
||||
|
||||
fun isExtensionFunctionToIgnore(call: UCallExpression): Boolean =
|
||||
call
|
||||
.takeIf { it.methodName == LET_METHOD || it.methodName == ALSO_METHOD || it.methodName == RUN_METHOD || it.methodName == APPLY_METHOD }
|
||||
?.resolve()
|
||||
?.containingClass?.qualifiedName == STANDARD_CLASS
|
||||
}
|
||||
Reference in New Issue
Block a user