FIR: Implement moduleDescriptor in Fir2IrPluginContext
A ModuleDescriptor is needed to create external package fragments with descriptors (see JvmSymbols.kt). Descriptorless external package fragments can fail in code using obsolete descriptor based APIs.
This commit is contained in:
@@ -97,7 +97,7 @@ class Fir2IrConverter(
|
||||
}
|
||||
|
||||
if (irGenerationExtensions.isNotEmpty()) {
|
||||
val pluginContext = Fir2IrPluginContext(components)
|
||||
val pluginContext = Fir2IrPluginContext(components, irModuleFragment.descriptor)
|
||||
for (extension in irGenerationExtensions) {
|
||||
extension.generate(irModuleFragment, pluginContext)
|
||||
}
|
||||
|
||||
@@ -34,16 +34,14 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
|
||||
class Fir2IrPluginContext(private val components: Fir2IrComponents) : IrPluginContext {
|
||||
class Fir2IrPluginContext(
|
||||
private val components: Fir2IrComponents,
|
||||
@property:ObsoleteDescriptorBasedAPI override val moduleDescriptor: ModuleDescriptor
|
||||
) : IrPluginContext {
|
||||
companion object {
|
||||
private const val ERROR_MESSAGE = "This API is not supported for K2"
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
@FirIncompatiblePluginAPI
|
||||
override val moduleDescriptor: ModuleDescriptor
|
||||
get() = error(ERROR_MESSAGE)
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
@FirIncompatiblePluginAPI
|
||||
override val bindingContext: BindingContext
|
||||
|
||||
Reference in New Issue
Block a user