FIR IDE: add this labels to keyword completion

This commit is contained in:
Ilya Kirillov
2021-05-11 19:36:51 +02:00
committed by TeamCityServer
parent 47a596c214
commit ca320f2f8d
13 changed files with 165 additions and 29 deletions
+1
View File
@@ -8,6 +8,7 @@ dependencies {
compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:frontend"))
compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":idea:idea-frontend-independent"))
compileOnly(project(":js:js.frontend"))
compileOnly(project(":js:js.serializer"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) }
@@ -18,31 +18,6 @@ import org.jetbrains.kotlin.types.FlexibleType
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
fun KtFunctionLiteral.findLabelAndCall(): Pair<Name?, KtCallExpression?> {
val literalParent = (this.parent as KtLambdaExpression).parent
fun KtValueArgument.callExpression(): KtCallExpression? {
val parent = parent
return (if (parent is KtValueArgumentList) parent else this).parent as? KtCallExpression
}
when (literalParent) {
is KtLabeledExpression -> {
val callExpression = (literalParent.parent as? KtValueArgument)?.callExpression()
return Pair(literalParent.getLabelNameAsName(), callExpression)
}
is KtValueArgument -> {
val callExpression = literalParent.callExpression()
val label = (callExpression?.calleeExpression as? KtSimpleNameExpression)?.getReferencedNameAsName()
return Pair(label, callExpression)
}
else -> {
return Pair(null, null)
}
}
}
fun SmartCastManager.getSmartCastVariantsWithLessSpecificExcluded(
receiverToCast: ReceiverValue,