Minor: inject targetPlatform into ResolveElementCache

This commit is contained in:
Pavel V. Talanov
2015-07-30 15:18:37 +03:00
parent 7cbac51018
commit ddbf4c18d3
2 changed files with 5 additions and 5 deletions
@@ -52,7 +52,8 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
public class ResolveElementCache(
private val resolveSession: ResolveSession,
private val project: Project
private val project: Project,
private val targetPlatform: TargetPlatform
) : BodyResolveCache {
private class CachedFullResolve(val bindingContext: BindingContext, resolveElement: JetElement) {
private val modificationStamp: Long? = modificationStamp(resolveElement)
@@ -105,8 +106,6 @@ public class ResolveElementCache(
false)
private fun getTargetPlatform(file: JetFile): TargetPlatform = TargetPlatformDetector.getPlatform(file)
private fun probablyNothingCallableNames(): ProbablyNothingCallableNames {
return object : ProbablyNothingCallableNames {
override fun functionNames() = JetProbablyNothingFunctionShortNameIndex.getInstance().getAllKeys(project)
@@ -520,7 +519,7 @@ public class ResolveElementCache(
return createContainerForBodyResolve(
globalContext.withProject(file.getProject()).withModule(module),
trace,
getTargetPlatform(file),
targetPlatform,
statementFilter
).get<BodyResolver>()
}
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.psi.JetDeclaration;
import org.jetbrains.kotlin.psi.JetPsiUtil;
import org.jetbrains.kotlin.renderer.AbstractDescriptorRendererTest;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode;
import org.jetbrains.kotlin.resolve.lazy.ResolveSession;
@@ -32,7 +33,7 @@ public abstract class AbstractAdditionalResolveDescriptorRendererTest extends Ab
@Override
protected DeclarationDescriptor getDescriptor(@NotNull JetDeclaration declaration, @NotNull ResolveSession resolveSession) {
if (declaration instanceof JetClassInitializer || JetPsiUtil.isLocal(declaration)) {
ResolveElementCache resolveElementCache = new ResolveElementCache(resolveSession, getProject());
ResolveElementCache resolveElementCache = new ResolveElementCache(resolveSession, getProject(), JvmPlatform.INSTANCE$);
//noinspection ConstantConditions
return resolveElementCache.resolveToElement(declaration, BodyResolveMode.FULL).get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration);
}