Minor: get SmartCastManager as a service in CompletionSession and KotlinIndicesHelper

This commit is contained in:
Pavel V. Talanov
2015-07-28 20:03:03 +03:00
parent 2b9d49e787
commit 0a40b375a1
2 changed files with 6 additions and 2 deletions
@@ -24,6 +24,7 @@ import com.intellij.psi.stubs.StringStubIndexExtension
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionFacade
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
import org.jetbrains.kotlin.idea.caches.resolve.getService
import org.jetbrains.kotlin.idea.codeInsight.ReferenceVariantsHelper
import org.jetbrains.kotlin.idea.imports.importableFqName
import org.jetbrains.kotlin.idea.stubindex.*
@@ -114,7 +115,8 @@ public class KotlinIndicesHelper(
private fun possibleReceiverTypeNames(receiverValues: Collection<ReceiverValue>, dataFlowInfo: DataFlowInfo, bindingContext: BindingContext): Set<String> {
val result = HashSet<String>()
for (receiverValue in receiverValues) {
for (type in SmartCastManager().getSmartCastVariants(receiverValue, bindingContext, moduleDescriptor, dataFlowInfo)) {
val smartCastManager = resolutionFacade.getService<SmartCastManager>(moduleDescriptor)
for (type in smartCastManager.getSmartCastVariants(receiverValue, bindingContext, moduleDescriptor, dataFlowInfo)) {
result.addTypeNames(type)
}
}