Refactoring: introduced val location: LocationInfo? in LookupLocation and use it in LookupTracker::record
Original commit: a5d8b47083
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.jps.build
|
package org.jetbrains.kotlin.jps.build
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
|
import org.jetbrains.kotlin.incremental.components.LocationInfo
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||||
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
||||||
import org.jetbrains.kotlin.test.JetTestUtils
|
import org.jetbrains.kotlin.test.JetTestUtils
|
||||||
@@ -55,8 +56,8 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest(
|
|||||||
|
|
||||||
val lines = text.lines().toArrayList()
|
val lines = text.lines().toArrayList()
|
||||||
|
|
||||||
for ((line, lookupsFromLine) in lookupsFromFile.groupBy { it.lookupLine!! }) {
|
for ((line, lookupsFromLine) in lookupsFromFile.groupBy { it.lookupLine }) {
|
||||||
val columnToLookups = lookupsFromLine.groupBy { it.lookupColumn!! }.toList().sortedBy { it.first }
|
val columnToLookups = lookupsFromLine.groupBy { it.lookupColumn }.toList().sortedBy { it.first }
|
||||||
|
|
||||||
val lineContent = lines[line - 1]
|
val lineContent = lines[line - 1]
|
||||||
val parts = ArrayList<CharSequence>(columnToLookups.size * 2)
|
val parts = ArrayList<CharSequence>(columnToLookups.size * 2)
|
||||||
@@ -135,8 +136,8 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest(
|
|||||||
|
|
||||||
private data class LookupInfo(
|
private data class LookupInfo(
|
||||||
val lookupContainingFile: String,
|
val lookupContainingFile: String,
|
||||||
val lookupLine: Int?,
|
val lookupLine: Int,
|
||||||
val lookupColumn: Int?,
|
val lookupColumn: Int,
|
||||||
val scopeFqName: String,
|
val scopeFqName: String,
|
||||||
val scopeKind: ScopeKind,
|
val scopeKind: ScopeKind,
|
||||||
val name: String
|
val name: String
|
||||||
@@ -145,14 +146,9 @@ private data class LookupInfo(
|
|||||||
private class TestLookupTracker : LookupTracker {
|
private class TestLookupTracker : LookupTracker {
|
||||||
val lookups = arrayListOf<LookupInfo>()
|
val lookups = arrayListOf<LookupInfo>()
|
||||||
|
|
||||||
override val requiresLookupLineAndColumn: Boolean
|
override fun record(locationInfo: LocationInfo, scopeFqName: String, scopeKind: ScopeKind, name: String) {
|
||||||
get() = true
|
val (line, column) = locationInfo.position
|
||||||
|
lookups.add(LookupInfo(locationInfo.filePath, line, column, scopeFqName, scopeKind, name))
|
||||||
override fun record(
|
|
||||||
lookupContainingFile: String, lookupLine: Int?, lookupColumn: Int?,
|
|
||||||
scopeFqName: String, scopeKind: ScopeKind, name: String
|
|
||||||
) {
|
|
||||||
lookups.add(LookupInfo(lookupContainingFile, lookupLine, lookupColumn, scopeFqName, scopeKind, name))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user