Move DummyDelegate to :compiler:util
Deleted DummyDelegate from a pair of usages across the project, and moved it to :compiler:util module to avoid further duplicates
This commit is contained in:
committed by
Space Team
parent
2578bfefd5
commit
fd2954a8d3
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.fir.tree.generator.context
|
package org.jetbrains.kotlin.fir.tree.generator.context
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.tree.generator.model.*
|
import org.jetbrains.kotlin.fir.tree.generator.model.*
|
||||||
import org.jetbrains.kotlin.fir.tree.generator.util.DummyDelegate
|
import org.jetbrains.kotlin.utils.DummyDelegate
|
||||||
import kotlin.properties.ReadOnlyProperty
|
import kotlin.properties.ReadOnlyProperty
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.fir.tree.generator.model.Element
|
|||||||
import org.jetbrains.kotlin.fir.tree.generator.model.IntermediateBuilder
|
import org.jetbrains.kotlin.fir.tree.generator.model.IntermediateBuilder
|
||||||
import org.jetbrains.kotlin.fir.tree.generator.model.Type
|
import org.jetbrains.kotlin.fir.tree.generator.model.Type
|
||||||
import org.jetbrains.kotlin.fir.tree.generator.printer.BASE_PACKAGE
|
import org.jetbrains.kotlin.fir.tree.generator.printer.BASE_PACKAGE
|
||||||
import org.jetbrains.kotlin.fir.tree.generator.util.DummyDelegate
|
import org.jetbrains.kotlin.utils.DummyDelegate
|
||||||
import kotlin.properties.ReadOnlyProperty
|
import kotlin.properties.ReadOnlyProperty
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|||||||
+1
-7
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.diagnostics
|
|||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
|
import org.jetbrains.kotlin.utils.DummyDelegate
|
||||||
import kotlin.properties.ReadOnlyProperty
|
import kotlin.properties.ReadOnlyProperty
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
@@ -220,10 +221,3 @@ class DeprecationDiagnosticFactory4DelegateProvider<A, B, C, D>(
|
|||||||
return DummyDelegate(KtDiagnosticFactoryForDeprecation4(featureForError, warningFactory, errorFactory))
|
return DummyDelegate(KtDiagnosticFactoryForDeprecation4(featureForError, warningFactory, errorFactory))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class DummyDelegate<T>(val value: T) : ReadOnlyProperty<Any?, T> {
|
|
||||||
override fun getValue(thisRef: Any?, property: KProperty<*>): T {
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+3
-5
@@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.fir.tree.generator.util
|
package org.jetbrains.kotlin.utils
|
||||||
|
|
||||||
import kotlin.properties.ReadOnlyProperty
|
import kotlin.properties.ReadOnlyProperty
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
class DummyDelegate<T>(val value: T) : ReadOnlyProperty<Any?, T> {
|
class DummyDelegate<T>(val value: T) : ReadOnlyProperty<Any?, T> {
|
||||||
override fun getValue(thisRef: Any?, property: KProperty<*>): T {
|
override fun getValue(thisRef: Any?, property: KProperty<*>): T = value
|
||||||
return value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user