No more record path to file which contains current scope in LookupTracker
This commit is contained in:
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
|||||||
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.doNotAnalyze
|
import org.jetbrains.kotlin.psi.doNotAnalyze
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
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 lineAndColumn = if (requiresLookupLineAndColumn) getLineAndColumnInPsiFile(containingJetFile, from.element.textRange) else null
|
||||||
|
|
||||||
val scopeContainingDeclaration = inScope.getContainingDeclaration()
|
val scopeContainingDeclaration = inScope.getContainingDeclaration()
|
||||||
val scopeFilePath = DescriptorToSourceUtils.getContainingFile(scopeContainingDeclaration)?.virtualFile?.path
|
|
||||||
|
|
||||||
val scopeKind =
|
val scopeKind =
|
||||||
when (scopeContainingDeclaration) {
|
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}")
|
else -> throw AssertionError("Unexpected containing declaration type: ${scopeContainingDeclaration.javaClass}")
|
||||||
}
|
}
|
||||||
|
|
||||||
record(containingFilePath, lineAndColumn?.line, lineAndColumn?.column,
|
record(containingFilePath, lineAndColumn?.line, lineAndColumn?.column, scopeContainingDeclaration.fqNameUnsafe.asString(), scopeKind, name.asString())
|
||||||
scopeContainingDeclaration.fqNameUnsafe.asString(), scopeFilePath, scopeKind,
|
|
||||||
name.asString())
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public interface LookupTracker {
|
|||||||
lookupLine: Int?,
|
lookupLine: Int?,
|
||||||
lookupColumn: Int?,
|
lookupColumn: Int?,
|
||||||
scopeFqName: String,
|
scopeFqName: String,
|
||||||
scopeContainingFile: String?,
|
|
||||||
scopeKind: ScopeKind,
|
scopeKind: ScopeKind,
|
||||||
name: String
|
name: String
|
||||||
)
|
)
|
||||||
@@ -38,7 +37,6 @@ public interface LookupTracker {
|
|||||||
lookupLine: Int?,
|
lookupLine: Int?,
|
||||||
lookupColumn: Int?,
|
lookupColumn: Int?,
|
||||||
scopeFqName: String,
|
scopeFqName: String,
|
||||||
scopeContainingFile: String?,
|
|
||||||
scopeKind: ScopeKind,
|
scopeKind: ScopeKind,
|
||||||
name: String
|
name: String
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -66,13 +66,10 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest(
|
|||||||
val end = column - 1
|
val end = column - 1
|
||||||
parts.add(lineContent.subSequence(start, end))
|
parts.add(lineContent.subSequence(start, end))
|
||||||
|
|
||||||
val stringifyLookupInfo: LookupInfo.() -> String = {
|
val lookups = lookupsFromColumn.distinct().joinToString(separator = " ", prefix = "/*", postfix = "*/") {
|
||||||
val scopeKindChar = scopeKind.toString()[0].toLowerCase()
|
it.scopeKind.toString()[0].toLowerCase().toString() + ":" + it.scopeFqName
|
||||||
val scopeFileOrEmpty = scopeContainingFile?.let { "($it)" } ?: ""
|
|
||||||
"$scopeKindChar:$scopeFqName$scopeFileOrEmpty"
|
|
||||||
}
|
}
|
||||||
|
parts.add(lookups)
|
||||||
parts.add(lookupsFromColumn.distinct().joinToString(separator = " ", prefix = "/*", postfix = "*/", transform = stringifyLookupInfo))
|
|
||||||
|
|
||||||
start = end
|
start = end
|
||||||
}
|
}
|
||||||
@@ -101,7 +98,6 @@ private data class LookupInfo(
|
|||||||
val lookupLine: Int?,
|
val lookupLine: Int?,
|
||||||
val lookupColumn: Int?,
|
val lookupColumn: Int?,
|
||||||
val scopeFqName: String,
|
val scopeFqName: String,
|
||||||
val scopeContainingFile: String?,
|
|
||||||
val scopeKind: ScopeKind,
|
val scopeKind: ScopeKind,
|
||||||
val name: String
|
val name: String
|
||||||
)
|
)
|
||||||
@@ -114,10 +110,9 @@ private class TestLookupTracker : LookupTracker {
|
|||||||
|
|
||||||
override fun record(
|
override fun record(
|
||||||
lookupContainingFile: String, lookupLine: Int?, lookupColumn: Int?,
|
lookupContainingFile: String, lookupLine: Int?, lookupColumn: Int?,
|
||||||
scopeFqName: String, scopeContainingFile: String?, scopeKind: ScopeKind,
|
scopeFqName: String, scopeKind: ScopeKind, name: String
|
||||||
name: String
|
|
||||||
) {
|
) {
|
||||||
lookups.add(LookupInfo(lookupContainingFile, lookupLine, lookupColumn, scopeFqName, scopeContainingFile, scopeKind, name))
|
lookups.add(LookupInfo(lookupContainingFile, lookupLine, lookupColumn, scopeFqName, scopeKind, name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user