[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,
|
ktTypeAlias.startOffsetSkippingComments, ktTypeAlias.endOffset,
|
||||||
symbol,
|
symbol,
|
||||||
typeAliasDescriptor.expandedType.toIrType(),
|
typeAliasDescriptor.expandedType.toIrType(),
|
||||||
IrDeclarationOrigin.DEFINED
|
IrDeclarationOrigin.DEFINED,
|
||||||
|
typeAliasDescriptor
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
generateGlobalTypeParametersDeclarations(irTypeAlias, typeAliasDescriptor.declaredTypeParameters)
|
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 {
|
fun generateEnumEntry(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor, symbol: IrEnumEntrySymbol): IrEnumEntry {
|
||||||
// TODO: corresponging class?
|
// TODO: corresponging class?
|
||||||
val irEntry = IrEnumEntryImpl(startOffset, endOffset, origin, symbol)
|
val irEntry = IrEnumEntryImpl(startOffset, endOffset, origin, symbol, descriptor.name)
|
||||||
|
|
||||||
return irEntry
|
return irEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
fun generateTypeAlias(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: TypeAliasDescriptor, symbol: IrTypeAliasSymbol): IrTypeAlias {
|
fun generateTypeAlias(
|
||||||
val irAlias = IrTypeAliasImpl.fromSymbolDescriptor(startOffset, endOffset, symbol, descriptor.expandedType.toIrType(), origin)
|
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)
|
generateGlobalTypeParametersDeclarations(irAlias, descriptor.declaredTypeParameters)
|
||||||
|
|
||||||
|
|||||||
@@ -38,14 +38,6 @@ class IrEnumEntryImpl(
|
|||||||
IrEnumEntry,
|
IrEnumEntry,
|
||||||
EnumEntryCarrier {
|
EnumEntryCarrier {
|
||||||
|
|
||||||
constructor(
|
|
||||||
startOffset: Int,
|
|
||||||
endOffset: Int,
|
|
||||||
origin: IrDeclarationOrigin,
|
|
||||||
symbol: IrEnumEntrySymbol
|
|
||||||
) :
|
|
||||||
this(startOffset, endOffset, origin, symbol, symbol.descriptor.name)
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ class IrFileImpl(
|
|||||||
IrElementBase(0, fileEntry.maxOffset),
|
IrElementBase(0, fileEntry.maxOffset),
|
||||||
IrFile {
|
IrFile {
|
||||||
|
|
||||||
|
@Deprecated(
|
||||||
|
"This constructor is left for native compilation purpose only. It uses symbol.descriptor attributes " +
|
||||||
|
"Please provide FqName explicitly"
|
||||||
|
)
|
||||||
constructor(
|
constructor(
|
||||||
fileEntry: SourceManager.FileEntry,
|
fileEntry: SourceManager.FileEntry,
|
||||||
symbol: IrFileSymbol
|
symbol: IrFileSymbol
|
||||||
|
|||||||
+5
-4
@@ -66,15 +66,16 @@ class IrTypeAliasImpl(
|
|||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
symbol: IrTypeAliasSymbol,
|
symbol: IrTypeAliasSymbol,
|
||||||
expandedType: IrType,
|
expandedType: IrType,
|
||||||
origin: IrDeclarationOrigin
|
origin: IrDeclarationOrigin,
|
||||||
|
descriptor: TypeAliasDescriptor
|
||||||
) =
|
) =
|
||||||
IrTypeAliasImpl(
|
IrTypeAliasImpl(
|
||||||
startOffset, endOffset,
|
startOffset, endOffset,
|
||||||
symbol,
|
symbol,
|
||||||
symbol.descriptor.name,
|
descriptor.name,
|
||||||
symbol.descriptor.visibility,
|
descriptor.visibility,
|
||||||
expandedType,
|
expandedType,
|
||||||
symbol.descriptor.isActual,
|
descriptor.isActual,
|
||||||
origin
|
origin
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user