Minor: Convert CallablePlacement to sealed class

(cherry picked from commit 47073b5)
This commit is contained in:
Alexey Sedunov
2016-07-14 20:30:24 +03:00
parent e1f58c554d
commit 82bdd1e42b
@@ -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