[IR] Reorder parameters in IrFactory#createField
This is to prepare for IrFactory auto-generation (KT-59308).
This commit is contained in:
committed by
Space Team
parent
90f6c53bf8
commit
0b7db067e6
+10
-3
@@ -43,9 +43,16 @@ inline fun IrFactory.buildClass(builder: IrClassBuilder.() -> Unit) =
|
||||
@PublishedApi
|
||||
internal fun IrFactory.buildField(builder: IrFieldBuilder): IrField = with(builder) {
|
||||
createField(
|
||||
startOffset, endOffset, origin,
|
||||
IrFieldSymbolImpl(),
|
||||
name, type, visibility, isFinal, isExternal, isStatic,
|
||||
startOffset = startOffset,
|
||||
endOffset = endOffset,
|
||||
origin = origin,
|
||||
name = name,
|
||||
visibility = visibility,
|
||||
symbol = IrFieldSymbolImpl(),
|
||||
type = type,
|
||||
isFinal = isFinal,
|
||||
isStatic = isStatic,
|
||||
isExternal = isExternal,
|
||||
).also {
|
||||
it.metadata = metadata
|
||||
}
|
||||
|
||||
@@ -79,13 +79,13 @@ interface IrFactory {
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrFieldSymbol,
|
||||
name: Name,
|
||||
type: IrType,
|
||||
visibility: DescriptorVisibility,
|
||||
symbol: IrFieldSymbol,
|
||||
type: IrType,
|
||||
isFinal: Boolean,
|
||||
isExternal: Boolean,
|
||||
isStatic: Boolean,
|
||||
isExternal: Boolean,
|
||||
): IrField
|
||||
|
||||
fun createFunction(
|
||||
|
||||
@@ -97,13 +97,13 @@ abstract class AbstractIrFactoryImpl : IrFactory {
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrFieldSymbol,
|
||||
name: Name,
|
||||
type: IrType,
|
||||
visibility: DescriptorVisibility,
|
||||
symbol: IrFieldSymbol,
|
||||
type: IrType,
|
||||
isFinal: Boolean,
|
||||
isExternal: Boolean,
|
||||
isStatic: Boolean,
|
||||
isExternal: Boolean,
|
||||
): IrField =
|
||||
IrFieldImpl(startOffset, endOffset, origin, symbol, name, type, visibility, isFinal, isExternal, isStatic, factory = this)
|
||||
|
||||
|
||||
+7
-7
@@ -138,25 +138,25 @@ class IrFactoryImplForJsIC(override val stageController: StageController) : Abst
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrFieldSymbol,
|
||||
name: Name,
|
||||
type: IrType,
|
||||
visibility: DescriptorVisibility,
|
||||
symbol: IrFieldSymbol,
|
||||
type: IrType,
|
||||
isFinal: Boolean,
|
||||
isExternal: Boolean,
|
||||
isStatic: Boolean
|
||||
isStatic: Boolean,
|
||||
isExternal: Boolean
|
||||
): IrField {
|
||||
return super.createField(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
type,
|
||||
visibility,
|
||||
symbol,
|
||||
type,
|
||||
isFinal,
|
||||
isExternal,
|
||||
isStatic,
|
||||
isExternal,
|
||||
).register()
|
||||
}
|
||||
|
||||
|
||||
@@ -81,17 +81,17 @@ class LazyIrFactory(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrFieldSymbol,
|
||||
name: Name,
|
||||
type: IrType,
|
||||
visibility: DescriptorVisibility,
|
||||
symbol: IrFieldSymbol,
|
||||
type: IrType,
|
||||
isFinal: Boolean,
|
||||
isExternal: Boolean,
|
||||
isStatic: Boolean
|
||||
isStatic: Boolean,
|
||||
isExternal: Boolean
|
||||
): IrField = if (symbol.isBound)
|
||||
symbol.owner
|
||||
else
|
||||
delegate.createField(startOffset, endOffset, origin, symbol, name, type, visibility, isFinal, isExternal, isStatic)
|
||||
delegate.createField(startOffset, endOffset, origin, name, visibility, symbol, type, isFinal, isStatic, isExternal)
|
||||
|
||||
override fun createFunction(
|
||||
startOffset: Int,
|
||||
|
||||
@@ -264,15 +264,16 @@ open class DeepCopyIrTreeWithSymbols(
|
||||
|
||||
override fun visitField(declaration: IrField): IrField =
|
||||
declaration.factory.createField(
|
||||
declaration.startOffset, declaration.endOffset,
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolRemapper.getDeclaredField(declaration.symbol),
|
||||
symbolRenamer.getFieldName(declaration.symbol),
|
||||
declaration.type.remapType(),
|
||||
declaration.visibility,
|
||||
startOffset = declaration.startOffset,
|
||||
endOffset = declaration.endOffset,
|
||||
origin = mapDeclarationOrigin(declaration.origin),
|
||||
name = symbolRenamer.getFieldName(declaration.symbol),
|
||||
visibility = declaration.visibility,
|
||||
symbol = symbolRemapper.getDeclaredField(declaration.symbol),
|
||||
type = declaration.type.remapType(),
|
||||
isFinal = declaration.isFinal,
|
||||
isExternal = declaration.isExternal,
|
||||
isStatic = declaration.isStatic,
|
||||
isExternal = declaration.isExternal,
|
||||
).apply {
|
||||
transformAnnotations(declaration)
|
||||
initializer = declaration.initializer?.transform()
|
||||
|
||||
@@ -715,9 +715,16 @@ open class SymbolTable(
|
||||
visibility: DescriptorVisibility? = null,
|
||||
fieldFactory: (IrFieldSymbol) -> IrField = {
|
||||
irFactory.createField(
|
||||
startOffset, endOffset, origin, it, nameProvider.nameForDeclaration(descriptor), type,
|
||||
visibility ?: it.descriptor.visibility, !it.descriptor.isVar, it.descriptor.isEffectivelyExternal(),
|
||||
it.descriptor.dispatchReceiverParameter == null
|
||||
startOffset = startOffset,
|
||||
endOffset = endOffset,
|
||||
origin = origin,
|
||||
name = nameProvider.nameForDeclaration(descriptor),
|
||||
visibility = visibility ?: it.descriptor.visibility,
|
||||
symbol = it,
|
||||
type = type,
|
||||
isFinal = !it.descriptor.isVar,
|
||||
isStatic = it.descriptor.dispatchReceiverParameter == null,
|
||||
isExternal = it.descriptor.isEffectivelyExternal(),
|
||||
).apply {
|
||||
metadata = DescriptorMetadataSource.Property(it.descriptor)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user