Introduce @FrontendInternals annotation
#KT-39643
This commit is contained in:
@@ -25,6 +25,7 @@ import com.intellij.psi.stubs.StringStubIndexExtension
|
||||
import com.intellij.util.indexing.IdFilter
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.FrontendInternals
|
||||
import org.jetbrains.kotlin.idea.caches.KotlinShortNamesCache
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.*
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.util.getJavaMemberDescriptor
|
||||
@@ -72,6 +73,7 @@ class KotlinIndicesHelper(
|
||||
private val project = resolutionFacade.project
|
||||
private val scopeWithoutKotlin = scope.excludeKotlinSources() as GlobalSearchScope
|
||||
|
||||
@OptIn(FrontendInternals::class)
|
||||
private val descriptorFilter: (DeclarationDescriptor) -> Boolean = filter@{
|
||||
if (resolutionFacade.frontendService<DeprecationResolver>().isHiddenInResolution(it)) return@filter false
|
||||
if (!visibilityFilter(it)) return@filter false
|
||||
@@ -471,6 +473,7 @@ class KotlinIndicesHelper(
|
||||
processor(descriptor)
|
||||
|
||||
// SAM-adapter
|
||||
@OptIn(FrontendInternals::class)
|
||||
val syntheticScopes = resolutionFacade.getFrontendService(SyntheticScopes::class.java).forceEnableSamAdapters()
|
||||
val contributedFunctions = container.staticScope.getContributedFunctions(descriptor.name, NoLookupLocation.FROM_IDE)
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.idea.FrontendInternals
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.resolve.frontendService
|
||||
import org.jetbrains.kotlin.idea.util.getImplicitReceiversWithInstance
|
||||
@@ -34,6 +35,7 @@ class SmartCastCalculator(
|
||||
receiver: KtExpression?,
|
||||
resolutionFacade: ResolutionFacade
|
||||
) {
|
||||
@OptIn(FrontendInternals::class)
|
||||
private val dataFlowValueFactory = resolutionFacade.frontendService<DataFlowValueFactory>()
|
||||
|
||||
// keys are VariableDescriptor's and ThisReceiver's
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.core
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.idea.FrontendInternals
|
||||
import org.jetbrains.kotlin.idea.analysis.computeTypeInContext
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
@@ -100,6 +101,7 @@ fun KtImportDirective.targetDescriptors(resolutionFacade: ResolutionFacade = thi
|
||||
return nameExpression.mainReference.resolveToDescriptors(resolutionFacade.analyze(nameExpression))
|
||||
}
|
||||
|
||||
@OptIn(FrontendInternals::class)
|
||||
fun Call.resolveCandidates(
|
||||
bindingContext: BindingContext,
|
||||
resolutionFacade: ResolutionFacade,
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.extensions.DeclarationAttributeAltererExtension
|
||||
import org.jetbrains.kotlin.idea.FrontendInternals
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
|
||||
@@ -113,6 +114,7 @@ fun KtCallExpression.getLastLambdaExpression(): KtLambdaExpression? {
|
||||
return valueArguments.lastOrNull()?.getArgumentExpression()?.unpackFunctionLiteral()
|
||||
}
|
||||
|
||||
@OptIn(FrontendInternals::class)
|
||||
fun KtCallExpression.canMoveLambdaOutsideParentheses(): Boolean {
|
||||
if (getStrictParentOfType<KtDelegatedSuperTypeEntry>() != null) return false
|
||||
if (getLastLambdaExpression() == null) return false
|
||||
|
||||
Reference in New Issue
Block a user