[IR] Allow Fir2Ir symbols in function factory

This commit is contained in:
Mikhail Glukhikh
2020-06-26 18:02:00 +03:00
parent a6234eb261
commit c4d41f48a3
7 changed files with 3 additions and 8 deletions
@@ -93,7 +93,7 @@ class IrFunctionFactory(private val irBuiltIns: IrBuiltIns, private val symbolTa
override fun functionN(arity: Int, declarator: SymbolTable.((IrClassSymbol) -> IrClass) -> IrClass): IrClass {
return functionNMap.getOrPut(arity) {
symbolTable.declarator { symbol ->
val descriptor = symbol.descriptor as FunctionClassDescriptor
val descriptor = symbol.descriptor
val descriptorFactory = FunctionDescriptorFactory.RealDescriptorFactory(descriptor, symbolTable)
createFunctionClass(symbol, false, false, arity, irBuiltIns.functionClass, kotlinPackageFragment, descriptorFactory)
}
@@ -159,7 +159,7 @@ class IrFunctionFactory(private val irBuiltIns: IrBuiltIns, private val symbolTa
abstract fun classReceiverParameterDescriptor(): ReceiverParameterDescriptor
abstract fun FunctionDescriptor.memberReceiverParameterDescriptor(): ReceiverParameterDescriptor
class RealDescriptorFactory(private val classDescriptor: FunctionClassDescriptor, symbolTable: SymbolTable) :
class RealDescriptorFactory(private val classDescriptor: ClassDescriptor, symbolTable: SymbolTable) :
FunctionDescriptorFactory(symbolTable) {
override fun memberDescriptor(name: String, factory: (IrSimpleFunctionSymbol) -> IrSimpleFunction): IrSimpleFunctionSymbol {
val descriptor = classDescriptor.unsubstitutedMemberScope.run {
@@ -439,6 +439,7 @@ class IrFunctionFactory(private val irBuiltIns: IrBuiltIns, private val symbolTa
descriptorFactory: FunctionDescriptorFactory
): IrClass {
val name = functionClassName(isK, isSuspend, n)
if (symbol.isBound) return symbol.owner
val klass = IrClassImpl(
offset, offset, classOrigin, symbol, Name.identifier(name), ClassKind.INTERFACE, Visibilities.PUBLIC, Modality.ABSTRACT
)
@@ -1,5 +1,4 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND_FIR: JVM_IR
interface I {
fun inherited(s: String): String = privateInherited(s)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// SKIP_JDK6
// TARGET_BACKEND: JVM
// FILE: F.java
@@ -1,6 +1,5 @@
// !JVM_DEFAULT_MODE: all-compatibility
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// JVM_TARGET: 1.8
// WITH_RUNTIME
@@ -1,6 +1,5 @@
// !JVM_DEFAULT_MODE: all
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// JVM_TARGET: 1.8
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
import java.io.*
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FULL_JDK