Minor: Convert CallablePlacement to sealed class
(cherry picked from commit 47073b5)
This commit is contained in:
+4
-4
@@ -125,9 +125,9 @@ class CallableBuilderConfiguration(
|
|||||||
val enableSubstitutions: Boolean = true
|
val enableSubstitutions: Boolean = true
|
||||||
)
|
)
|
||||||
|
|
||||||
interface CallablePlacement {
|
sealed class CallablePlacement {
|
||||||
class WithReceiver(val receiverTypeCandidate: TypeCandidate): CallablePlacement
|
class WithReceiver(val receiverTypeCandidate: TypeCandidate): CallablePlacement()
|
||||||
class NoReceiver(val containingElement: PsiElement): CallablePlacement
|
class NoReceiver(val containingElement: PsiElement): CallablePlacement()
|
||||||
}
|
}
|
||||||
|
|
||||||
class CallableBuilder(val config: CallableBuilderConfiguration) {
|
class CallableBuilder(val config: CallableBuilderConfiguration) {
|
||||||
@@ -243,7 +243,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
|||||||
val classDeclaration = receiverClassDescriptor?.let { DescriptorToSourceUtils.getSourceFromDescriptor(it) }
|
val classDeclaration = receiverClassDescriptor?.let { DescriptorToSourceUtils.getSourceFromDescriptor(it) }
|
||||||
containingElement = if (!config.isExtension && classDeclaration != null) classDeclaration else config.currentFile
|
containingElement = if (!config.isExtension && classDeclaration != null) classDeclaration else config.currentFile
|
||||||
}
|
}
|
||||||
else -> throw IllegalArgumentException("Unexpected placement: $placement")
|
else -> throw IllegalArgumentException("Placement wan't initialized")
|
||||||
}
|
}
|
||||||
val receiverType = receiverClassDescriptor?.defaultType
|
val receiverType = receiverClassDescriptor?.defaultType
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user