[IR] Unbind construction methods of IR file/enum entry/type alias from symbol.descriptor
This commit is contained in:
+2
-1
@@ -86,7 +86,8 @@ class DeclarationGenerator(override val context: GeneratorContext) : Generator {
|
||||
ktTypeAlias.startOffsetSkippingComments, ktTypeAlias.endOffset,
|
||||
symbol,
|
||||
typeAliasDescriptor.expandedType.toIrType(),
|
||||
IrDeclarationOrigin.DEFINED
|
||||
IrDeclarationOrigin.DEFINED,
|
||||
typeAliasDescriptor
|
||||
)
|
||||
}
|
||||
generateGlobalTypeParametersDeclarations(irTypeAlias, typeAliasDescriptor.declaredTypeParameters)
|
||||
|
||||
+11
-3
@@ -99,13 +99,21 @@ class StandaloneDeclarationGenerator(private val context: GeneratorContext) {
|
||||
|
||||
fun generateEnumEntry(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor, symbol: IrEnumEntrySymbol): IrEnumEntry {
|
||||
// TODO: corresponging class?
|
||||
val irEntry = IrEnumEntryImpl(startOffset, endOffset, origin, symbol)
|
||||
val irEntry = IrEnumEntryImpl(startOffset, endOffset, origin, symbol, descriptor.name)
|
||||
|
||||
return irEntry
|
||||
}
|
||||
|
||||
fun generateTypeAlias(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: TypeAliasDescriptor, symbol: IrTypeAliasSymbol): IrTypeAlias {
|
||||
val irAlias = IrTypeAliasImpl.fromSymbolDescriptor(startOffset, endOffset, symbol, descriptor.expandedType.toIrType(), origin)
|
||||
fun generateTypeAlias(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
descriptor: TypeAliasDescriptor,
|
||||
symbol: IrTypeAliasSymbol
|
||||
): IrTypeAlias {
|
||||
val irAlias = IrTypeAliasImpl.fromSymbolDescriptor(
|
||||
startOffset, endOffset, symbol, descriptor.expandedType.toIrType(), origin, descriptor
|
||||
)
|
||||
|
||||
generateGlobalTypeParametersDeclarations(irAlias, descriptor.declaredTypeParameters)
|
||||
|
||||
|
||||
@@ -38,14 +38,6 @@ class IrEnumEntryImpl(
|
||||
IrEnumEntry,
|
||||
EnumEntryCarrier {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrEnumEntrySymbol
|
||||
) :
|
||||
this(startOffset, endOffset, origin, symbol, symbol.descriptor.name)
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ class IrFileImpl(
|
||||
IrElementBase(0, fileEntry.maxOffset),
|
||||
IrFile {
|
||||
|
||||
@Deprecated(
|
||||
"This constructor is left for native compilation purpose only. It uses symbol.descriptor attributes " +
|
||||
"Please provide FqName explicitly"
|
||||
)
|
||||
constructor(
|
||||
fileEntry: SourceManager.FileEntry,
|
||||
symbol: IrFileSymbol
|
||||
|
||||
+5
-4
@@ -66,15 +66,16 @@ class IrTypeAliasImpl(
|
||||
endOffset: Int,
|
||||
symbol: IrTypeAliasSymbol,
|
||||
expandedType: IrType,
|
||||
origin: IrDeclarationOrigin
|
||||
origin: IrDeclarationOrigin,
|
||||
descriptor: TypeAliasDescriptor
|
||||
) =
|
||||
IrTypeAliasImpl(
|
||||
startOffset, endOffset,
|
||||
symbol,
|
||||
symbol.descriptor.name,
|
||||
symbol.descriptor.visibility,
|
||||
descriptor.name,
|
||||
descriptor.visibility,
|
||||
expandedType,
|
||||
symbol.descriptor.isActual,
|
||||
descriptor.isActual,
|
||||
origin
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user