No need to pass fq-names to import when we have bindingContext

This commit is contained in:
Valentin Kipyatkov
2017-05-25 18:49:42 +03:00
parent 996292264b
commit d3ea7c3a14
2 changed files with 4 additions and 9 deletions
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.idea.references.mainReference
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
import org.jetbrains.kotlin.idea.util.getResolutionScope
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getReceiverExpression
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
@@ -54,12 +53,11 @@ class CodeToInlineBuilder(
fun prepareCodeToInline(
mainExpression: KtExpression?,
statementsBefore: List<KtExpression>,
analyze: () -> BindingContext,
importFqNames: Collection<FqName> = emptyList()
analyze: () -> BindingContext
): CodeToInline {
var bindingContext = analyze()
val codeToInline = MutableCodeToInline(mainExpression, statementsBefore.toMutableList(), importFqNames.toMutableSet())
val codeToInline = MutableCodeToInline(mainExpression, statementsBefore.toMutableList(), mutableSetOf())
bindingContext = insertExplicitTypeArguments(codeToInline, bindingContext, analyze)
@@ -78,12 +78,9 @@ object ReplaceWithAnnotationAnalyzer {
val expressionTypingServices = resolutionFacade.getFrontendService(module, ExpressionTypingServices::class.java)
fun analyzeExpression(): BindingContext {
return expression.analyzeInContext(scope, expressionTypingServices = expressionTypingServices)
}
fun analyzeExpression() = expression.analyzeInContext(scope, expressionTypingServices = expressionTypingServices)
return CodeToInlineBuilder(symbolDescriptor, resolutionFacade)
.prepareCodeToInline(expression, emptyList(), ::analyzeExpression, importFqNames = importFqNames(annotation))
return CodeToInlineBuilder(symbolDescriptor, resolutionFacade).prepareCodeToInline(expression, emptyList(), ::analyzeExpression)
}
fun analyzeClassifierReplacement(