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
|
||||
)
|
||||
|
||||
interface CallablePlacement {
|
||||
class WithReceiver(val receiverTypeCandidate: TypeCandidate): CallablePlacement
|
||||
class NoReceiver(val containingElement: PsiElement): CallablePlacement
|
||||
sealed class CallablePlacement {
|
||||
class WithReceiver(val receiverTypeCandidate: TypeCandidate): CallablePlacement()
|
||||
class NoReceiver(val containingElement: PsiElement): CallablePlacement()
|
||||
}
|
||||
|
||||
class CallableBuilder(val config: CallableBuilderConfiguration) {
|
||||
@@ -243,7 +243,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
||||
val classDeclaration = receiverClassDescriptor?.let { DescriptorToSourceUtils.getSourceFromDescriptor(it) }
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user