[FIR IDE] Unify creation of KtFe10DescFunctionSymbol
It will be required later to implement overrides unwrapping logic for descriptor-based symbols
This commit is contained in:
committed by
teamcityserver
parent
fa8bb47bdf
commit
2a8431d80c
+2
-2
@@ -65,8 +65,8 @@ internal class KtFe10CallResolver(
|
||||
val accessorSymbol = when (targetDescriptor) {
|
||||
is SyntheticJavaPropertyDescriptor -> {
|
||||
when {
|
||||
access.isWrite -> targetDescriptor.setMethod?.let { KtFe10DescFunctionSymbol(it, analysisContext) }
|
||||
access.isRead -> KtFe10DescFunctionSymbol(targetDescriptor.getMethod, analysisContext)
|
||||
access.isWrite -> targetDescriptor.setMethod?.let { KtFe10DescFunctionSymbol.build(it, analysisContext) }
|
||||
access.isRead -> KtFe10DescFunctionSymbol.build(targetDescriptor.getMethod, analysisContext)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.returnTypeOrNothing
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
|
||||
|
||||
internal class KtFe10DescFunctionSymbol(
|
||||
internal class KtFe10DescFunctionSymbol private constructor(
|
||||
override val descriptor: FunctionDescriptor,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtFunctionSymbol(), KtFe10DescMemberSymbol<FunctionDescriptor> {
|
||||
@@ -91,4 +91,10 @@ internal class KtFe10DescFunctionSymbol(
|
||||
|
||||
return KtFe10NeverRestoringSymbolPointer()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun build(descriptor: FunctionDescriptor, analysisContext: Fe10AnalysisContext): KtFe10DescFunctionSymbol {
|
||||
return KtFe10DescFunctionSymbol(descriptor, analysisContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -52,12 +52,12 @@ internal class KtFe10DescSyntheticJavaPropertySymbol(
|
||||
}
|
||||
|
||||
override val javaGetterSymbol: KtFunctionSymbol
|
||||
get() = withValidityAssertion { KtFe10DescFunctionSymbol(descriptor.getMethod, analysisContext) }
|
||||
get() = withValidityAssertion { KtFe10DescFunctionSymbol.build(descriptor.getMethod, analysisContext) }
|
||||
|
||||
override val javaSetterSymbol: KtFunctionSymbol?
|
||||
get() = withValidityAssertion {
|
||||
val setMethod = descriptor.setMethod ?: return null
|
||||
return KtFe10DescFunctionSymbol(setMethod, analysisContext)
|
||||
return KtFe10DescFunctionSymbol.build(setMethod, analysisContext)
|
||||
}
|
||||
|
||||
override val hasSetter: Boolean
|
||||
|
||||
+2
-2
@@ -52,12 +52,12 @@ internal class KtFe10DescSyntheticJavaPropertySymbolForOverride(
|
||||
}
|
||||
|
||||
override val javaGetterSymbol: KtFunctionSymbol
|
||||
get() = withValidityAssertion { KtFe10DescFunctionSymbol(descriptor.getterMethod, analysisContext) }
|
||||
get() = withValidityAssertion { KtFe10DescFunctionSymbol.build(descriptor.getterMethod, analysisContext) }
|
||||
|
||||
override val javaSetterSymbol: KtFunctionSymbol?
|
||||
get() = withValidityAssertion {
|
||||
val setMethod = descriptor.setterMethod ?: return null
|
||||
return KtFe10DescFunctionSymbol(setMethod, analysisContext)
|
||||
return KtFe10DescFunctionSymbol.build(setMethod, analysisContext)
|
||||
}
|
||||
|
||||
override val hasSetter: Boolean
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.analysis.api.*
|
||||
import org.jetbrains.kotlin.analysis.api.annotations.KtNamedConstantValue
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtDeclarationRendererOptions
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisContext
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.*
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.base.KtFe10PsiSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.*
|
||||
@@ -129,7 +128,7 @@ internal fun CallableDescriptor.toKtCallableSymbol(analysisContext: Fe10Analysis
|
||||
if (DescriptorUtils.isAnonymousFunction(this)) {
|
||||
KtFe10DescAnonymousFunctionSymbol(this, analysisContext)
|
||||
} else {
|
||||
KtFe10DescFunctionSymbol(this, analysisContext)
|
||||
KtFe10DescFunctionSymbol.build(this, analysisContext)
|
||||
}
|
||||
}
|
||||
is SyntheticFieldDescriptor -> KtFe10DescSyntheticFieldSymbol(this, analysisContext)
|
||||
|
||||
Reference in New Issue
Block a user