mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[amper] AMPER-544 update cached compilerArguments if changed in workspace model
GitOrigin-RevId: c3520c618f0eda983035fed387732a8351955be5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
91ad706863
commit
fc77b60658
+10
-4
@@ -49,23 +49,29 @@ class KotlinFacetSettingsWorkspaceModel(val entity: KotlinSettingsEntity.Builder
|
||||
}
|
||||
|
||||
private var _compilerArguments: CommonCompilerArguments? = null
|
||||
private var _lastKnownCompilerArguments: String? = null
|
||||
override var compilerArguments: CommonCompilerArguments?
|
||||
get() {
|
||||
if (_compilerArguments != null) {
|
||||
val currentSerializedArguments = entity.compilerArguments
|
||||
if (_compilerArguments != null && currentSerializedArguments == _lastKnownCompilerArguments) {
|
||||
// Cache is valid, return the cached value
|
||||
return _compilerArguments
|
||||
}
|
||||
|
||||
val serializedArguments = entity.compilerArguments
|
||||
_compilerArguments = serializedArguments?.let {
|
||||
// Deserialize and update the cache
|
||||
_compilerArguments = currentSerializedArguments?.let {
|
||||
CompilerArgumentsSerializer.deserializeFromString(it)
|
||||
}
|
||||
_lastKnownCompilerArguments = currentSerializedArguments
|
||||
|
||||
return _compilerArguments
|
||||
}
|
||||
set(value) {
|
||||
entity.compilerArguments = CompilerArgumentsSerializer.serializeToString(value)
|
||||
val serializedValue = CompilerArgumentsSerializer.serializeToString(value)
|
||||
entity.compilerArguments = serializedValue
|
||||
updateMergedArguments()
|
||||
_compilerArguments = value?.unfrozen()
|
||||
_lastKnownCompilerArguments = serializedValue
|
||||
}
|
||||
|
||||
override val mergedCompilerArguments: CommonCompilerArguments?
|
||||
|
||||
Reference in New Issue
Block a user