No hardcoded nothing callables needed anymore
This commit is contained in:
@@ -55,7 +55,8 @@ public abstract class ElementResolver protected(
|
||||
|
||||
public open fun hasElementAdditionalResolveCached(jetElement: JetElement): Boolean = false
|
||||
|
||||
protected open fun probablyNothingCallableNames(): ProbablyNothingCallableNames = DefaultNothingCallableNames
|
||||
protected open fun probablyNothingCallableNames(): ProbablyNothingCallableNames
|
||||
= throw UnsupportedOperationException("Cannot use partial body resolve with no Nothing-functions index");
|
||||
|
||||
public fun resolveToElement(jetElement: JetElement, bodyResolveMode: BodyResolveMode = BodyResolveMode.FULL): BindingContext {
|
||||
var jetElement = jetElement
|
||||
|
||||
+2
-9
@@ -17,13 +17,6 @@
|
||||
package org.jetbrains.kotlin.resolve.lazy
|
||||
|
||||
public trait ProbablyNothingCallableNames {
|
||||
public fun functionNames(): Set<String>
|
||||
public fun propertyNames(): Set<String>
|
||||
}
|
||||
|
||||
public object DefaultNothingCallableNames : ProbablyNothingCallableNames {
|
||||
private val hardcodedNames = setOf("error")
|
||||
|
||||
override fun functionNames() = hardcodedNames
|
||||
override fun propertyNames(): Set<String> = setOf()
|
||||
public fun functionNames(): Collection<String>
|
||||
public fun propertyNames(): Collection<String>
|
||||
}
|
||||
|
||||
@@ -30,13 +30,14 @@ import org.jetbrains.kotlin.psi.JetElement;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.resolve.AdditionalCheckerProvider;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.lazy.*;
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode;
|
||||
import org.jetbrains.kotlin.resolve.lazy.ElementResolver;
|
||||
import org.jetbrains.kotlin.resolve.lazy.ProbablyNothingCallableNames;
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession;
|
||||
import org.jetbrains.kotlin.storage.LazyResolveStorageManager;
|
||||
import org.jetbrains.kotlin.storage.MemoizedFunctionToNotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ResolveElementCache extends ElementResolver {
|
||||
private final Project project;
|
||||
@@ -94,20 +95,15 @@ public class ResolveElementCache extends ElementResolver {
|
||||
return new ProbablyNothingCallableNames() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> functionNames() {
|
||||
public Collection<String> functionNames() {
|
||||
// we have to add hardcoded-names until we have Kotlin compiled classes in caches
|
||||
Set<String> hardcodedNames = DefaultNothingCallableNames.INSTANCE$.functionNames();
|
||||
Collection<String> indexedNames = JetProbablyNothingFunctionShortNameIndex.getInstance().getAllKeys(project);
|
||||
Set<String> set = new HashSet<String>(hardcodedNames.size() + indexedNames.size());
|
||||
set.addAll(hardcodedNames);
|
||||
set.addAll(indexedNames);
|
||||
return set;
|
||||
return JetProbablyNothingFunctionShortNameIndex.getInstance().getAllKeys(project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> propertyNames() {
|
||||
return new HashSet<String>(JetProbablyNothingPropertyShortNameIndex.getInstance().getAllKeys(project));
|
||||
public Collection<String> propertyNames() {
|
||||
return JetProbablyNothingPropertyShortNameIndex.getInstance().getAllKeys(project);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user