No more record path to file which contains current scope in LookupTracker

This commit is contained in:
Zalim Bashorov
2015-08-18 20:08:22 +03:00
parent 7790c2fd71
commit 673df1f085
3 changed files with 6 additions and 17 deletions
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.incremental.components.ScopeKind
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.doNotAnalyze
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.scopes.JetScope
@@ -43,7 +42,6 @@ public fun LookupTracker.record(from: LookupLocation, inScope: JetScope, name: N
val lineAndColumn = if (requiresLookupLineAndColumn) getLineAndColumnInPsiFile(containingJetFile, from.element.textRange) else null
val scopeContainingDeclaration = inScope.getContainingDeclaration()
val scopeFilePath = DescriptorToSourceUtils.getContainingFile(scopeContainingDeclaration)?.virtualFile?.path
val scopeKind =
when (scopeContainingDeclaration) {
@@ -52,7 +50,5 @@ public fun LookupTracker.record(from: LookupLocation, inScope: JetScope, name: N
else -> throw AssertionError("Unexpected containing declaration type: ${scopeContainingDeclaration.javaClass}")
}
record(containingFilePath, lineAndColumn?.line, lineAndColumn?.column,
scopeContainingDeclaration.fqNameUnsafe.asString(), scopeFilePath, scopeKind,
name.asString())
record(containingFilePath, lineAndColumn?.line, lineAndColumn?.column, scopeContainingDeclaration.fqNameUnsafe.asString(), scopeKind, name.asString())
}
@@ -26,7 +26,6 @@ public interface LookupTracker {
lookupLine: Int?,
lookupColumn: Int?,
scopeFqName: String,
scopeContainingFile: String?,
scopeKind: ScopeKind,
name: String
)
@@ -38,7 +37,6 @@ public interface LookupTracker {
lookupLine: Int?,
lookupColumn: Int?,
scopeFqName: String,
scopeContainingFile: String?,
scopeKind: ScopeKind,
name: String
) {
@@ -66,13 +66,10 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest(
val end = column - 1
parts.add(lineContent.subSequence(start, end))
val stringifyLookupInfo: LookupInfo.() -> String = {
val scopeKindChar = scopeKind.toString()[0].toLowerCase()
val scopeFileOrEmpty = scopeContainingFile?.let { "($it)" } ?: ""
"$scopeKindChar:$scopeFqName$scopeFileOrEmpty"
val lookups = lookupsFromColumn.distinct().joinToString(separator = " ", prefix = "/*", postfix = "*/") {
it.scopeKind.toString()[0].toLowerCase().toString() + ":" + it.scopeFqName
}
parts.add(lookupsFromColumn.distinct().joinToString(separator = " ", prefix = "/*", postfix = "*/", transform = stringifyLookupInfo))
parts.add(lookups)
start = end
}
@@ -101,7 +98,6 @@ private data class LookupInfo(
val lookupLine: Int?,
val lookupColumn: Int?,
val scopeFqName: String,
val scopeContainingFile: String?,
val scopeKind: ScopeKind,
val name: String
)
@@ -114,10 +110,9 @@ private class TestLookupTracker : LookupTracker {
override fun record(
lookupContainingFile: String, lookupLine: Int?, lookupColumn: Int?,
scopeFqName: String, scopeContainingFile: String?, scopeKind: ScopeKind,
name: String
scopeFqName: String, scopeKind: ScopeKind, name: String
) {
lookups.add(LookupInfo(lookupContainingFile, lookupLine, lookupColumn, scopeFqName, scopeContainingFile, scopeKind, name))
lookups.add(LookupInfo(lookupContainingFile, lookupLine, lookupColumn, scopeFqName, scopeKind, name))
}
}