Minor: inject targetPlatform into ResolveElementCache
This commit is contained in:
@@ -52,7 +52,8 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
|||||||
|
|
||||||
public class ResolveElementCache(
|
public class ResolveElementCache(
|
||||||
private val resolveSession: ResolveSession,
|
private val resolveSession: ResolveSession,
|
||||||
private val project: Project
|
private val project: Project,
|
||||||
|
private val targetPlatform: TargetPlatform
|
||||||
) : BodyResolveCache {
|
) : BodyResolveCache {
|
||||||
private class CachedFullResolve(val bindingContext: BindingContext, resolveElement: JetElement) {
|
private class CachedFullResolve(val bindingContext: BindingContext, resolveElement: JetElement) {
|
||||||
private val modificationStamp: Long? = modificationStamp(resolveElement)
|
private val modificationStamp: Long? = modificationStamp(resolveElement)
|
||||||
@@ -105,8 +106,6 @@ public class ResolveElementCache(
|
|||||||
false)
|
false)
|
||||||
|
|
||||||
|
|
||||||
private fun getTargetPlatform(file: JetFile): TargetPlatform = TargetPlatformDetector.getPlatform(file)
|
|
||||||
|
|
||||||
private fun probablyNothingCallableNames(): ProbablyNothingCallableNames {
|
private fun probablyNothingCallableNames(): ProbablyNothingCallableNames {
|
||||||
return object : ProbablyNothingCallableNames {
|
return object : ProbablyNothingCallableNames {
|
||||||
override fun functionNames() = JetProbablyNothingFunctionShortNameIndex.getInstance().getAllKeys(project)
|
override fun functionNames() = JetProbablyNothingFunctionShortNameIndex.getInstance().getAllKeys(project)
|
||||||
@@ -520,7 +519,7 @@ public class ResolveElementCache(
|
|||||||
return createContainerForBodyResolve(
|
return createContainerForBodyResolve(
|
||||||
globalContext.withProject(file.getProject()).withModule(module),
|
globalContext.withProject(file.getProject()).withModule(module),
|
||||||
trace,
|
trace,
|
||||||
getTargetPlatform(file),
|
targetPlatform,
|
||||||
statementFilter
|
statementFilter
|
||||||
).get<BodyResolver>()
|
).get<BodyResolver>()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.psi.JetDeclaration;
|
|||||||
import org.jetbrains.kotlin.psi.JetPsiUtil;
|
import org.jetbrains.kotlin.psi.JetPsiUtil;
|
||||||
import org.jetbrains.kotlin.renderer.AbstractDescriptorRendererTest;
|
import org.jetbrains.kotlin.renderer.AbstractDescriptorRendererTest;
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
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.BodyResolveMode;
|
||||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession;
|
import org.jetbrains.kotlin.resolve.lazy.ResolveSession;
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ public abstract class AbstractAdditionalResolveDescriptorRendererTest extends Ab
|
|||||||
@Override
|
@Override
|
||||||
protected DeclarationDescriptor getDescriptor(@NotNull JetDeclaration declaration, @NotNull ResolveSession resolveSession) {
|
protected DeclarationDescriptor getDescriptor(@NotNull JetDeclaration declaration, @NotNull ResolveSession resolveSession) {
|
||||||
if (declaration instanceof JetClassInitializer || JetPsiUtil.isLocal(declaration)) {
|
if (declaration instanceof JetClassInitializer || JetPsiUtil.isLocal(declaration)) {
|
||||||
ResolveElementCache resolveElementCache = new ResolveElementCache(resolveSession, getProject());
|
ResolveElementCache resolveElementCache = new ResolveElementCache(resolveSession, getProject(), JvmPlatform.INSTANCE$);
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
return resolveElementCache.resolveToElement(declaration, BodyResolveMode.FULL).get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration);
|
return resolveElementCache.resolveToElement(declaration, BodyResolveMode.FULL).get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user