Minor: Convert CallablePlacement to sealed class

(cherry picked from commit 47073b5)

GitOrigin-RevId: 130f275e58d92c07500940a19b20b11b4ddc5086
This commit is contained in:
Alexey Sedunov
2016-07-20 15:39:16 +03:00
committed by intellij-monorepo-bot
parent 3df0be85a3
commit e2ed9103e9
@@ -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