File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
build/src/org/jetbrains/kotlin/incremental
jps-plugin/src/org/jetbrains/kotlin/jps/build Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.incremental.components.Position
23
23
import org.jetbrains.kotlin.incremental.components.ScopeKind
24
24
import org.jetbrains.kotlin.incremental.storage.*
25
25
import org.jetbrains.kotlin.utils.Printer
26
+ import org.jetbrains.kotlin.utils.keysToMap
26
27
import java.io.File
27
28
import java.util.*
28
29
@@ -61,11 +62,16 @@ open class LookupStorage(private val targetDataDir: File) : BasicMapsOwner() {
61
62
}
62
63
}
63
64
64
- fun add (lookupSymbol : LookupSymbol , containingPaths : Collection <String >) {
65
- val key = LookupSymbolKey (lookupSymbol.name, lookupSymbol.scope)
66
- val fileIds = containingPaths.map { addFileIfNeeded(File (it)) }.toHashSet()
67
- fileIds.addAll(lookupMap[key] ? : emptySet())
68
- lookupMap[key] = fileIds
65
+ fun addAll (lookups : Set <Map .Entry <LookupSymbol , Collection <String >>>) {
66
+ val allPaths = lookups.flatMapTo(HashSet <String >()) { it.value }
67
+ val pathToId = allPaths.keysToMap { addFileIfNeeded(File (it)) }
68
+
69
+ for ((lookupSymbol, paths) in lookups) {
70
+ val key = LookupSymbolKey (lookupSymbol.name, lookupSymbol.scope)
71
+ val fileIds = paths.mapTo(HashSet <Int >()) { pathToId[it]!! }
72
+ fileIds.addAll(lookupMap[key] ? : emptySet())
73
+ lookupMap[key] = fileIds
74
+ }
69
75
}
70
76
71
77
fun removeLookupsFrom (file : File ) {
Original file line number Diff line number Diff line change @@ -542,7 +542,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
542
542
val removedFiles = chunk.targets.flatMap { KotlinSourceFileCollector .getRemovedKotlinFiles(dirtyFilesHolder, it) }
543
543
removedFiles.forEach { lookupStorage.removeLookupsFrom(it) }
544
544
545
- lookupTracker.lookups.entrySet().forEach { lookupStorage.add(it.key, it.value) }
545
+ lookupStorage.addAll( lookupTracker.lookups.entrySet())
546
546
}
547
547
548
548
// if null is returned, nothing was done
You can’t perform that action at this time.
0 commit comments