Refactoring: introduced val location: LocationInfo? in LookupLocation and use it in LookupTracker::record

Original commit: a5d8b47083
This commit is contained in:
Zalim Bashorov
2015-09-22 21:03:59 +03:00
parent 731268085f
commit 6a7fcd61fe
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.jps.build
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.ScopeKind
import org.jetbrains.kotlin.test.JetTestUtils
@@ -55,8 +56,8 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest(
val lines = text.lines().toArrayList()
for ((line, lookupsFromLine) in lookupsFromFile.groupBy { it.lookupLine!! }) {
val columnToLookups = lookupsFromLine.groupBy { it.lookupColumn!! }.toList().sortedBy { it.first }
for ((line, lookupsFromLine) in lookupsFromFile.groupBy { it.lookupLine }) {
val columnToLookups = lookupsFromLine.groupBy { it.lookupColumn }.toList().sortedBy { it.first }
val lineContent = lines[line - 1]
val parts = ArrayList<CharSequence>(columnToLookups.size * 2)
@@ -135,8 +136,8 @@ abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest(
private data class LookupInfo(
val lookupContainingFile: String,
val lookupLine: Int?,
val lookupColumn: Int?,
val lookupLine: Int,
val lookupColumn: Int,
val scopeFqName: String,
val scopeKind: ScopeKind,
val name: String
@@ -145,14 +146,9 @@ private data class LookupInfo(
private class TestLookupTracker : LookupTracker {
val lookups = arrayListOf<LookupInfo>()
override val requiresLookupLineAndColumn: Boolean
get() = true
override fun record(
lookupContainingFile: String, lookupLine: Int?, lookupColumn: Int?,
scopeFqName: String, scopeKind: ScopeKind, name: String
) {
lookups.add(LookupInfo(lookupContainingFile, lookupLine, lookupColumn, scopeFqName, scopeKind, name))
override fun record(locationInfo: LocationInfo, scopeFqName: String, scopeKind: ScopeKind, name: String) {
val (line, column) = locationInfo.position
lookups.add(LookupInfo(locationInfo.filePath, line, column, scopeFqName, scopeKind, name))
}
}