[Plugin API] Provide special context in EP for link-time resolve

- requires to customize declarations from synthetic declarations
This commit is contained in:
Roman Artemev
2020-08-21 15:19:14 +03:00
parent ea98062241
commit a095909d5c
7 changed files with 74 additions and 10 deletions
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2020 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.ir.builders
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.ir.util.ReferenceSymbolTable
import org.jetbrains.kotlin.ir.util.TypeTranslator
import org.jetbrains.kotlin.resolve.BindingContext
interface TranslationPluginContext : IrGeneratorContext {
val moduleDescriptor: ModuleDescriptor
val bindingContext: BindingContext
val symbolTable: ReferenceSymbolTable
val typeTranslator: TypeTranslator
}
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.ir.linkage
import org.jetbrains.kotlin.ir.builders.TranslationPluginContext
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.symbols.IrSymbol
@@ -12,7 +13,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSymbol
interface IrDeserializer : IrProvider {
interface IrLinkerExtension {
fun resolveSymbol(symbol: IrSymbol): IrDeclaration? = null
fun resolveSymbol(symbol: IrSymbol, context: TranslationPluginContext): IrDeclaration? = null
}
fun init(moduleFragment: IrModuleFragment?, extensions: Collection<IrLinkerExtension>) {}