Remove unused parts

This commit is contained in:
Natalia Selezneva
2020-04-16 16:26:01 +03:00
parent 7ecaf35647
commit da76fff83c
4 changed files with 22 additions and 43 deletions
@@ -30,7 +30,6 @@ interface ScriptConfigurationCache {
fun setApplied(file: VirtualFile, configurationSnapshot: ScriptConfigurationSnapshot)
fun setLoaded(file: VirtualFile, configurationSnapshot: ScriptConfigurationSnapshot)
fun markOutOfDate(scope: ScriptConfigurationCacheScope)
fun allApplied(): Map<VirtualFile, ScriptCompilationConfigurationWrapper>
fun clear()
@@ -39,7 +38,6 @@ interface ScriptConfigurationCache {
sealed class ScriptConfigurationCacheScope {
object All : ScriptConfigurationCacheScope()
class File(val file: KtFile) : ScriptConfigurationCacheScope()
class Except(val file: KtFile) : ScriptConfigurationCacheScope()
}
data class ScriptConfigurationState(
@@ -36,29 +36,6 @@ open class ScriptConfigurationMemoryCache(
memoryCache.put(file, old.copy(loaded = configurationSnapshot))
}
@Synchronized
override fun markOutOfDate(scope: ScriptConfigurationCacheScope) {
when (scope) {
is ScriptConfigurationCacheScope.File -> {
val file = scope.file.originalFile.virtualFile
markFileOutOfDate(file)
}
is ScriptConfigurationCacheScope.Except -> {
val file = scope.file.originalFile.virtualFile
memoryCache.entrySet().forEach {
if (it.key != file) {
markFileOutOfDate(it.key)
}
}
}
is ScriptConfigurationCacheScope.All ->{
memoryCache.entrySet().forEach {
markFileOutOfDate(it.key)
}
}
}
}
@Synchronized
@Suppress("UNCHECKED_CAST")
override fun allApplied(): Map<VirtualFile, ScriptCompilationConfigurationWrapper> {
@@ -76,14 +53,4 @@ open class ScriptConfigurationMemoryCache(
memoryCache.clear()
}
@Synchronized
private fun markFileOutOfDate(file: VirtualFile) {
val old = memoryCache[file] ?: return
memoryCache.put(
file, old.copy(
applied = old.applied?.copy(inputs = CachedConfigurationInputs.OutOfDate),
loaded = old.loaded?.copy(inputs = CachedConfigurationInputs.OutOfDate)
)
)
}
}
@@ -24,11 +24,6 @@ interface ScriptConfigurationUpdater {
*/
fun ensureConfigurationUpToDate(files: List<KtFile>): Boolean
/**
* Invalidate current configuration
*/
fun postponeConfigurationReload(scope: ScriptConfigurationCacheScope)
/**
* Suggest to update script configuration if configuration for [file] is out of date
*/