Excluding top-level members of library source files when analyzing them lazily
This commit is contained in:
@@ -37,6 +37,9 @@ import org.jetbrains.jet.lang.resolve.TopDownAnalysisParameters
|
|||||||
import com.intellij.openapi.progress.ProcessCanceledException
|
import com.intellij.openapi.progress.ProcessCanceledException
|
||||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext
|
import org.jetbrains.jet.lang.resolve.BindingTraceContext
|
||||||
import com.intellij.psi.util.CachedValueProvider
|
import com.intellij.psi.util.CachedValueProvider
|
||||||
|
import org.jetbrains.jet.asJava.LightClassUtil
|
||||||
|
import com.intellij.openapi.roots.libraries.LibraryUtil
|
||||||
|
import org.jetbrains.jet.lang.resolve.LibrarySourceHacks
|
||||||
|
|
||||||
private val LOG = Logger.getInstance(javaClass<KotlinResolveCache>())
|
private val LOG = Logger.getInstance(javaClass<KotlinResolveCache>())
|
||||||
|
|
||||||
@@ -59,8 +62,18 @@ class KotlinResolveCache(
|
|||||||
ApplicationUtils.warnTimeConsuming(LOG)
|
ApplicationUtils.warnTimeConsuming(LOG)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
for (element in task!!.elements) {
|
||||||
|
val file = element.getContainingFile() as JetFile
|
||||||
|
val virtualFile = file.getVirtualFile()
|
||||||
|
if (LightClassUtil.belongsToKotlinBuiltIns(file)
|
||||||
|
|| virtualFile != null && LibraryUtil.findLibraryEntry(virtualFile, file.getProject()) != null) {
|
||||||
|
// Library sources: mark file to skip
|
||||||
|
file.putUserData(LibrarySourceHacks.SKIP_TOP_LEVEL_MEMBERS, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// todo: look for pre-existing results for this element or its parents
|
// todo: look for pre-existing results for this element or its parents
|
||||||
val trace = DelegatingBindingTrace(resolveSession.getBindingContext(), "Trace for resolution of " + task!!.elements.makeString(", "))
|
val trace = DelegatingBindingTrace(resolveSession.getBindingContext(), "Trace for resolution of " + task.elements.makeString(", "))
|
||||||
val injector = InjectorForTopDownAnalyzerForJvm(
|
val injector = InjectorForTopDownAnalyzerForJvm(
|
||||||
project,
|
project,
|
||||||
SimpleGlobalContext(resolveSession.getStorageManager(), resolveSession.getExceptionTracker()),
|
SimpleGlobalContext(resolveSession.getStorageManager(), resolveSession.getExceptionTracker()),
|
||||||
|
|||||||
Reference in New Issue
Block a user