From 809b7d83817a8cd1a07fb1c20b17023af3b1de36 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 9 Dec 2019 12:40:10 +0300 Subject: [PATCH] FirResolution: store enabled value in field with initial reading from component Before this commit, we read/wrote 'enabled' directly from PropertiesComponent. Now we do only initial reading and then store modified value in field. This should make 'enabled' reading faster. --- .../org/jetbrains/kotlin/idea/fir/FirResolution.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/fir/FirResolution.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/fir/FirResolution.kt index 3e8543d59b0..e4b8ae55064 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/fir/FirResolution.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/fir/FirResolution.kt @@ -12,9 +12,16 @@ object FirResolution { private const val ENABLED_BY_DEFAULT = false private const val optionName = "kotlin.use.fir.resolution" + private val initialEnabledValue: Boolean by lazy { + PropertiesComponent.getInstance().getBoolean(optionName, ENABLED_BY_DEFAULT) + } + + private var changedEnabledValue: Boolean? = null + var enabled: Boolean - get() = PropertiesComponent.getInstance().getBoolean(optionName, ENABLED_BY_DEFAULT) + get() = changedEnabledValue ?: initialEnabledValue set(value) { - PropertiesComponent.getInstance().setValue(optionName, value, ENABLED_BY_DEFAULT) + changedEnabledValue = value + //PropertiesComponent.getInstance().setValue(optionName, value, ENABLED_BY_DEFAULT) } } \ No newline at end of file