Fix KotlinBytecodeToolWindow: show bytecode correctly when there is inline function from another module

#KT-7409 Fixed
This commit is contained in:
Natalia Ukhorskaya
2015-04-16 12:09:05 +03:00
parent 06eb749f5a
commit 336886f115
2 changed files with 121 additions and 127 deletions
@@ -188,15 +188,6 @@ public class KotlinCacheService(val project: Project) {
return getCacheToAnalyzeFiles(listOf(file)).getLazyResolveSession(file)
}
public fun getAnalysisResults(elements: Collection<JetElement>): AnalysisResult {
if (elements.isEmpty()) return AnalysisResult.EMPTY
val files = elements.map { it.getContainingJetFile() }.toSet()
assertAreInSameModule(files)
return getCacheToAnalyzeFiles(files).getAnalysisResultsForElements(elements)
}
private fun getCacheToAnalyzeFiles(files: Collection<JetFile>): KotlinResolveCache {
val syntheticFiles = findSyntheticFiles(files)
return if (syntheticFiles.isNotEmpty()) {
@@ -220,19 +211,6 @@ public class KotlinCacheService(val project: Project) {
return if (contextFile is JetCodeFragment) contextFile.getContextFile() else contextFile
}
private fun assertAreInSameModule(elements: Collection<JetElement>) {
if (elements.size() <= 1) {
return
}
val thisInfo = elements.first().getModuleInfo()
elements.forEach {
val extraFileInfo = it.getModuleInfo()
assert(extraFileInfo == thisInfo) {
"All files under analysis should be in the same module.\nExpected: $thisInfo\nWas:$extraFileInfo"
}
}
}
public fun <T> get(extension: CacheExtension<T>): T {
return getGlobalCache(extension.platform)[extension]
}