JVM IR: Use WrappedClassDescriptor in class builder.
This commit is contained in:
committed by
max-kammerer
parent
be002fc417
commit
217f681b6e
+15
-8
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.backend.jvm.codegen
|
package org.jetbrains.kotlin.backend.jvm.codegen
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.backend.common.descriptors.WrappedClassDescriptor
|
||||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||||
import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry
|
import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry
|
||||||
import org.jetbrains.kotlin.backend.jvm.lower.constantValue
|
import org.jetbrains.kotlin.backend.jvm.lower.constantValue
|
||||||
@@ -51,19 +52,25 @@ open class ClassCodegen protected constructor(
|
|||||||
val typeMapper = context.typeMapper
|
val typeMapper = context.typeMapper
|
||||||
val methodSignatureMapper = context.methodSignatureMapper
|
val methodSignatureMapper = context.methodSignatureMapper
|
||||||
|
|
||||||
val descriptor = irClass.descriptor
|
|
||||||
|
|
||||||
val type: Type = typeMapper.mapClass(irClass)
|
val type: Type = typeMapper.mapClass(irClass)
|
||||||
|
|
||||||
val visitor: ClassBuilder = createClassBuilder()
|
val visitor: ClassBuilder = createClassBuilder()
|
||||||
|
|
||||||
val reifiedTypeParametersUsages = ReifiedTypeParametersUsages()
|
val reifiedTypeParametersUsages = ReifiedTypeParametersUsages()
|
||||||
|
|
||||||
open fun createClassBuilder() = state.factory.newVisitor(
|
open fun createClassBuilder(): ClassBuilder {
|
||||||
OtherOrigin(descriptor.psiElement, descriptor),
|
// The descriptor associated with an IrClass is never modified in lowerings, so it
|
||||||
type,
|
// doesn't reflect the state of the lowered class. To make the diagnostics work we
|
||||||
irClass.fileParent.loadSourceFilesInfo()
|
// pass in a wrapped descriptor instead.
|
||||||
)
|
// TODO: Migrate class builders away from descriptors
|
||||||
|
val descriptor = WrappedClassDescriptor()
|
||||||
|
descriptor.bind(irClass)
|
||||||
|
return state.factory.newVisitor(
|
||||||
|
OtherOrigin(descriptor.psiElement, descriptor),
|
||||||
|
type,
|
||||||
|
irClass.fileParent.loadSourceFilesInfo()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private var sourceMapper: DefaultSourceMapper? = null
|
private var sourceMapper: DefaultSourceMapper? = null
|
||||||
|
|
||||||
@@ -83,7 +90,7 @@ open class ClassCodegen protected constructor(
|
|||||||
val signature = getSignature(irClass, type, superClassInfo, typeMapper)
|
val signature = getSignature(irClass, type, superClassInfo, typeMapper)
|
||||||
|
|
||||||
visitor.defineClass(
|
visitor.defineClass(
|
||||||
descriptor.psiElement,
|
irClass.descriptor.psiElement,
|
||||||
state.classFileVersion,
|
state.classFileVersion,
|
||||||
irClass.flags,
|
irClass.flags,
|
||||||
signature.name,
|
signature.name,
|
||||||
|
|||||||
Vendored
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +InlineClasses
|
// !LANGUAGE: +InlineClasses
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
|
|
||||||
inline class Id(val id: String)
|
inline class Id(val id: String)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user