org.jetbrains.kotlin.fir.FirModuleCapabilities.kt Maven / Gradle / Ivy
/*
* 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.
*/
package org.jetbrains.kotlin.fir
import org.jetbrains.kotlin.fir.util.ConeTypeRegistry
import org.jetbrains.kotlin.util.AttributeArrayOwner
import org.jetbrains.kotlin.util.TypeRegistry
import kotlin.reflect.KClass
abstract class FirModuleCapability {
abstract val key: KClass
}
class FirModuleCapabilities private constructor(
capabilities: List
) : AttributeArrayOwner() {
companion object : ConeTypeRegistry() {
val Empty: FirModuleCapabilities = FirModuleCapabilities(emptyList())
fun create(attributes: List): FirModuleCapabilities {
return if (attributes.isEmpty()) {
Empty
} else {
FirModuleCapabilities(attributes)
}
}
}
init {
for (capability in capabilities) {
registerComponent(capability.key, capability)
}
}
override val typeRegistry: TypeRegistry
get() = Companion
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy