FIR2IR: use IR_EXTERNAL_DECLARATION_STUB for external classes
This commit is contained in:
+7
-5
@@ -196,7 +196,7 @@ class Fir2IrDeclarationStorage(
|
||||
getIrProperty(declaration, irClass)
|
||||
}
|
||||
is FirConstructor -> getIrConstructor(declaration, irClass)
|
||||
is FirRegularClass -> getIrClass(declaration)
|
||||
is FirRegularClass -> getIrClass(declaration, exactlySourceClass = false)
|
||||
else -> continue
|
||||
}
|
||||
}
|
||||
@@ -250,7 +250,7 @@ class Fir2IrDeclarationStorage(
|
||||
}
|
||||
}
|
||||
|
||||
private fun createIrClass(klass: FirClass<*>): IrClass {
|
||||
private fun createIrClass(klass: FirClass<*>, exactlySourceClass: Boolean = false): IrClass {
|
||||
// NB: klass can be either FirRegularClass or FirAnonymousObject
|
||||
if (klass is FirAnonymousObject) {
|
||||
return createIrAnonymousObject(klass)
|
||||
@@ -258,7 +258,9 @@ class Fir2IrDeclarationStorage(
|
||||
val regularClass = klass as FirRegularClass
|
||||
|
||||
val descriptor = WrappedClassDescriptor()
|
||||
val origin = IrDeclarationOrigin.DEFINED
|
||||
val origin =
|
||||
if (exactlySourceClass || firProvider.getFirClassifierContainerFileIfAny(klass.symbol) != null) IrDeclarationOrigin.DEFINED
|
||||
else IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB
|
||||
val visibility = regularClass.visibility
|
||||
val modality = if (regularClass.classKind == ClassKind.ENUM_CLASS) {
|
||||
regularClass.enumClassModality()
|
||||
@@ -298,8 +300,8 @@ class Fir2IrDeclarationStorage(
|
||||
return irClass
|
||||
}
|
||||
|
||||
fun getIrClass(klass: FirClass<*>): IrClass {
|
||||
return getCachedIrClass(klass) ?: createIrClass(klass)
|
||||
fun getIrClass(klass: FirClass<*>, exactlySourceClass: Boolean = true): IrClass {
|
||||
return getCachedIrClass(klass) ?: createIrClass(klass, exactlySourceClass)
|
||||
}
|
||||
|
||||
private fun createIrAnonymousObject(
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
FILE fqName:<root> fileName:/constFromBuiltins.kt
|
||||
PROPERTY name:test visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test type:kotlin.Int visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun <get-MIN_VALUE> (): kotlin.Int declared in kotlin.Int.Companion' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_OBJECT 'CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' type=kotlin.Int.Companion
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test> visibility:public modality:FINAL <> () returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:test visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test> (): kotlin.Int declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// DUMP_EXTERNAL_CLASS kotlin.Int
|
||||
|
||||
val test = Int.MIN_VALUE
|
||||
Reference in New Issue
Block a user