[FIR] Extract FirPluginKey into :core:compiler.common and rename it to GeneratedDeclarationKey

This is needed to avoid dependency on :compiler:fir:fir2ir module in
  backend parts of compiler plugins. It will allow to publish those
  parts into jars for IDE, where they are needed for working of debugger
  and bytecode toolwindow
This commit is contained in:
Dmitriy Novozhilov
2022-06-01 18:02:26 +03:00
committed by teamcity
parent a84ece7233
commit 83d0a3e7a3
23 changed files with 92 additions and 75 deletions
@@ -5,6 +5,8 @@
package org.jetbrains.kotlin.fir.declarations
import org.jetbrains.kotlin.GeneratedDeclarationKey
sealed class FirDeclarationOrigin(
private val displayName: String? = null,
val fromSupertypes: Boolean = false,
@@ -31,13 +33,12 @@ sealed class FirDeclarationOrigin(
object RenamedForOverride : FirDeclarationOrigin()
object WrappedIntegerOperator : FirDeclarationOrigin()
class Plugin(val key: FirPluginKey) : FirDeclarationOrigin(displayName = "Plugin[$key]", generated = true)
class Plugin(val key: GeneratedDeclarationKey) : FirDeclarationOrigin(displayName = "Plugin[$key]", generated = true)
override fun toString(): String {
return displayName ?: this::class.simpleName!!
}
}
abstract class FirPluginKey {
val origin: FirDeclarationOrigin = FirDeclarationOrigin.Plugin(this)
}
val GeneratedDeclarationKey.origin: FirDeclarationOrigin
get() = FirDeclarationOrigin.Plugin(this)