[JS IR] IrFactory which saves signatures for declarations created in BE
This commit is contained in:
committed by
TeamCityServer
parent
4e0d91d463
commit
56e1c4e38f
+2
-4
@@ -31,15 +31,13 @@ class IrAnonymousInitializerImpl(
|
|||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
override var origin: IrDeclarationOrigin,
|
override var origin: IrDeclarationOrigin,
|
||||||
override val symbol: IrAnonymousInitializerSymbol,
|
override val symbol: IrAnonymousInitializerSymbol,
|
||||||
override val isStatic: Boolean = false
|
override val isStatic: Boolean = false,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrAnonymousInitializer() {
|
) : IrAnonymousInitializer() {
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -41,15 +41,13 @@ open class IrClassImpl(
|
|||||||
override val isInline: Boolean = false,
|
override val isInline: Boolean = false,
|
||||||
override val isExpect: Boolean = false,
|
override val isExpect: Boolean = false,
|
||||||
override val isFun: Boolean = false,
|
override val isFun: Boolean = false,
|
||||||
override val source: SourceElement = SourceElement.NO_SOURCE
|
override val source: SourceElement = SourceElement.NO_SOURCE,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl
|
||||||
) : IrClass() {
|
) : IrClass() {
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -42,14 +42,12 @@ class IrConstructorImpl(
|
|||||||
override val isPrimary: Boolean,
|
override val isPrimary: Boolean,
|
||||||
override val isExpect: Boolean,
|
override val isExpect: Boolean,
|
||||||
override val containerSource: DeserializedContainerSource? = null,
|
override val containerSource: DeserializedContainerSource? = null,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrConstructor() {
|
) : IrConstructor() {
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -29,15 +29,13 @@ class IrEnumEntryImpl(
|
|||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
override var origin: IrDeclarationOrigin,
|
override var origin: IrDeclarationOrigin,
|
||||||
override val symbol: IrEnumEntrySymbol,
|
override val symbol: IrEnumEntrySymbol,
|
||||||
override val name: Name
|
override val name: Name,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrEnumEntry() {
|
) : IrEnumEntry() {
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -29,16 +29,14 @@ import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
|||||||
class IrErrorDeclarationImpl(
|
class IrErrorDeclarationImpl(
|
||||||
override val startOffset: Int,
|
override val startOffset: Int,
|
||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
private val _descriptor: DeclarationDescriptor?
|
private val _descriptor: DeclarationDescriptor?,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrErrorDeclaration() {
|
) : IrErrorDeclaration() {
|
||||||
override val descriptor: DeclarationDescriptor
|
override val descriptor: DeclarationDescriptor
|
||||||
get() = _descriptor ?: this.toIrBasedDescriptor()
|
get() = _descriptor ?: this.toIrBasedDescriptor()
|
||||||
|
|
||||||
override var origin: IrDeclarationOrigin = IrDeclarationOrigin.DEFINED
|
override var origin: IrDeclarationOrigin = IrDeclarationOrigin.DEFINED
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-13
@@ -19,8 +19,11 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
object IrFactoryImpl : IrFactory {
|
object IrFactoryImpl : AbstractIrFactoryImpl() {
|
||||||
override val stageController: StageController = StageController()
|
override val stageController: StageController = StageController()
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class AbstractIrFactoryImpl : IrFactory {
|
||||||
|
|
||||||
override fun createAnonymousInitializer(
|
override fun createAnonymousInitializer(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
@@ -29,7 +32,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
symbol: IrAnonymousInitializerSymbol,
|
symbol: IrAnonymousInitializerSymbol,
|
||||||
isStatic: Boolean,
|
isStatic: Boolean,
|
||||||
): IrAnonymousInitializer =
|
): IrAnonymousInitializer =
|
||||||
IrAnonymousInitializerImpl(startOffset, endOffset, origin, symbol, isStatic)
|
IrAnonymousInitializerImpl(startOffset, endOffset, origin, symbol, isStatic, factory = this)
|
||||||
|
|
||||||
override fun createClass(
|
override fun createClass(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
@@ -52,6 +55,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
IrClassImpl(
|
IrClassImpl(
|
||||||
startOffset, endOffset, origin, symbol, name, kind, visibility, modality,
|
startOffset, endOffset, origin, symbol, name, kind, visibility, modality,
|
||||||
isCompanion, isInner, isData, isExternal, isInline, isExpect, isFun, source,
|
isCompanion, isInner, isData, isExternal, isInline, isExpect, isFun, source,
|
||||||
|
factory = this
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createConstructor(
|
override fun createConstructor(
|
||||||
@@ -70,7 +74,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
): IrConstructor =
|
): IrConstructor =
|
||||||
IrConstructorImpl(
|
IrConstructorImpl(
|
||||||
startOffset, endOffset, origin, symbol, name, visibility, returnType, isInline, isExternal, isPrimary, isExpect,
|
startOffset, endOffset, origin, symbol, name, visibility, returnType, isInline, isExternal, isPrimary, isExpect,
|
||||||
containerSource,
|
containerSource, factory = this
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createEnumEntry(
|
override fun createEnumEntry(
|
||||||
@@ -80,14 +84,14 @@ object IrFactoryImpl : IrFactory {
|
|||||||
symbol: IrEnumEntrySymbol,
|
symbol: IrEnumEntrySymbol,
|
||||||
name: Name,
|
name: Name,
|
||||||
): IrEnumEntry =
|
): IrEnumEntry =
|
||||||
IrEnumEntryImpl(startOffset, endOffset, origin, symbol, name)
|
IrEnumEntryImpl(startOffset, endOffset, origin, symbol, name, factory = this)
|
||||||
|
|
||||||
override fun createErrorDeclaration(
|
override fun createErrorDeclaration(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
descriptor: DeclarationDescriptor?,
|
descriptor: DeclarationDescriptor?,
|
||||||
): IrErrorDeclaration =
|
): IrErrorDeclaration =
|
||||||
IrErrorDeclarationImpl(startOffset, endOffset, descriptor)
|
IrErrorDeclarationImpl(startOffset, endOffset, descriptor, factory = this)
|
||||||
|
|
||||||
override fun createField(
|
override fun createField(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
@@ -101,7 +105,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
isExternal: Boolean,
|
isExternal: Boolean,
|
||||||
isStatic: Boolean,
|
isStatic: Boolean,
|
||||||
): IrField =
|
): IrField =
|
||||||
IrFieldImpl(startOffset, endOffset, origin, symbol, name, type, visibility, isFinal, isExternal, isStatic)
|
IrFieldImpl(startOffset, endOffset, origin, symbol, name, type, visibility, isFinal, isExternal, isStatic, factory = this)
|
||||||
|
|
||||||
override fun createFunction(
|
override fun createFunction(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
@@ -125,7 +129,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
IrFunctionImpl(
|
IrFunctionImpl(
|
||||||
startOffset, endOffset, origin, symbol, name, visibility, modality, returnType,
|
startOffset, endOffset, origin, symbol, name, visibility, modality, returnType,
|
||||||
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect, isFakeOverride,
|
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect, isFakeOverride,
|
||||||
containerSource
|
containerSource, factory = this
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createFakeOverrideFunction(
|
override fun createFakeOverrideFunction(
|
||||||
@@ -147,6 +151,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
IrFakeOverrideFunctionImpl(
|
IrFakeOverrideFunctionImpl(
|
||||||
startOffset, endOffset, origin, name, visibility, modality, returnType,
|
startOffset, endOffset, origin, name, visibility, modality, returnType,
|
||||||
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||||
|
factory = this
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createLocalDelegatedProperty(
|
override fun createLocalDelegatedProperty(
|
||||||
@@ -158,7 +163,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
type: IrType,
|
type: IrType,
|
||||||
isVar: Boolean,
|
isVar: Boolean,
|
||||||
): IrLocalDelegatedProperty =
|
): IrLocalDelegatedProperty =
|
||||||
IrLocalDelegatedPropertyImpl(startOffset, endOffset, origin, symbol, name, type, isVar)
|
IrLocalDelegatedPropertyImpl(startOffset, endOffset, origin, symbol, name, type, isVar, factory = this)
|
||||||
|
|
||||||
override fun createProperty(
|
override fun createProperty(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
@@ -180,7 +185,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
IrPropertyImpl(
|
IrPropertyImpl(
|
||||||
startOffset, endOffset, origin, symbol, name, visibility, modality,
|
startOffset, endOffset, origin, symbol, name, visibility, modality,
|
||||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect, isFakeOverride,
|
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect, isFakeOverride,
|
||||||
containerSource,
|
containerSource, factory = this
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createFakeOverrideProperty(
|
override fun createFakeOverrideProperty(
|
||||||
@@ -200,6 +205,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
IrFakeOverridePropertyImpl(
|
IrFakeOverridePropertyImpl(
|
||||||
startOffset, endOffset, origin, name, visibility, modality,
|
startOffset, endOffset, origin, name, visibility, modality,
|
||||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||||
|
factory = this
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createTypeAlias(
|
override fun createTypeAlias(
|
||||||
@@ -212,7 +218,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
isActual: Boolean,
|
isActual: Boolean,
|
||||||
origin: IrDeclarationOrigin,
|
origin: IrDeclarationOrigin,
|
||||||
): IrTypeAlias =
|
): IrTypeAlias =
|
||||||
IrTypeAliasImpl(startOffset, endOffset, symbol, name, visibility, expandedType, isActual, origin)
|
IrTypeAliasImpl(startOffset, endOffset, symbol, name, visibility, expandedType, isActual, origin, factory = this)
|
||||||
|
|
||||||
override fun createTypeParameter(
|
override fun createTypeParameter(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
@@ -224,7 +230,7 @@ object IrFactoryImpl : IrFactory {
|
|||||||
isReified: Boolean,
|
isReified: Boolean,
|
||||||
variance: Variance,
|
variance: Variance,
|
||||||
): IrTypeParameter =
|
): IrTypeParameter =
|
||||||
IrTypeParameterImpl(startOffset, endOffset, origin, symbol, name, index, isReified, variance)
|
IrTypeParameterImpl(startOffset, endOffset, origin, symbol, name, index, isReified, variance, factory = this)
|
||||||
|
|
||||||
override fun createValueParameter(
|
override fun createValueParameter(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
@@ -241,7 +247,8 @@ object IrFactoryImpl : IrFactory {
|
|||||||
isAssignable: Boolean,
|
isAssignable: Boolean,
|
||||||
): IrValueParameter =
|
): IrValueParameter =
|
||||||
IrValueParameterImpl(
|
IrValueParameterImpl(
|
||||||
startOffset, endOffset, origin, symbol, name, index, type, varargElementType, isCrossinline, isNoinline, isHidden, isAssignable
|
startOffset, endOffset, origin, symbol, name, index, type, varargElementType,
|
||||||
|
isCrossinline, isNoinline, isHidden, isAssignable, factory = this
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createExpressionBody(
|
override fun createExpressionBody(
|
||||||
@@ -282,4 +289,4 @@ object IrFactoryImpl : IrFactory {
|
|||||||
initializer: IrBlockBody.() -> Unit,
|
initializer: IrBlockBody.() -> Unit,
|
||||||
): IrBlockBody =
|
): IrBlockBody =
|
||||||
IrBlockBodyImpl(startOffset, endOffset, initializer)
|
IrBlockBodyImpl(startOffset, endOffset, initializer)
|
||||||
}
|
}
|
||||||
+395
@@ -0,0 +1,395 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
|
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||||
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||||
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
|
class IrFactoryImplForJsIC(override val stageController: StageController) : AbstractIrFactoryImpl(), IdSignatureRetriever {
|
||||||
|
private val declarationToSignature = mutableMapOf<IrDeclaration, IdSignature>()
|
||||||
|
|
||||||
|
private fun <T : IrDeclaration> T.register(): T {
|
||||||
|
val parentSig = stageController.currentDeclaration?.let { declarationSignature(it) } ?: return this
|
||||||
|
|
||||||
|
stageController.createSignature(parentSig)?.let { declarationToSignature[this] = it}
|
||||||
|
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun declarationSignature(declaration: IrDeclaration): IdSignature? {
|
||||||
|
return declarationToSignature[declaration] ?: declaration.symbol.signature
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createAnonymousInitializer(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrAnonymousInitializerSymbol,
|
||||||
|
isStatic: Boolean
|
||||||
|
): IrAnonymousInitializer {
|
||||||
|
return super.createAnonymousInitializer(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
isStatic,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createClass(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrClassSymbol,
|
||||||
|
name: Name,
|
||||||
|
kind: ClassKind,
|
||||||
|
visibility: DescriptorVisibility,
|
||||||
|
modality: Modality,
|
||||||
|
isCompanion: Boolean,
|
||||||
|
isInner: Boolean,
|
||||||
|
isData: Boolean,
|
||||||
|
isExternal: Boolean,
|
||||||
|
isInline: Boolean,
|
||||||
|
isExpect: Boolean,
|
||||||
|
isFun: Boolean,
|
||||||
|
source: SourceElement
|
||||||
|
): IrClass {
|
||||||
|
return super.createClass(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
kind,
|
||||||
|
visibility,
|
||||||
|
modality,
|
||||||
|
isCompanion,
|
||||||
|
isInner,
|
||||||
|
isData,
|
||||||
|
isExternal,
|
||||||
|
isInline,
|
||||||
|
isExpect,
|
||||||
|
isFun,
|
||||||
|
source,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createConstructor(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrConstructorSymbol,
|
||||||
|
name: Name,
|
||||||
|
visibility: DescriptorVisibility,
|
||||||
|
returnType: IrType,
|
||||||
|
isInline: Boolean,
|
||||||
|
isExternal: Boolean,
|
||||||
|
isPrimary: Boolean,
|
||||||
|
isExpect: Boolean,
|
||||||
|
containerSource: DeserializedContainerSource?
|
||||||
|
): IrConstructor {
|
||||||
|
return super.createConstructor(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
visibility,
|
||||||
|
returnType,
|
||||||
|
isInline,
|
||||||
|
isExternal,
|
||||||
|
isPrimary,
|
||||||
|
isExpect,
|
||||||
|
containerSource,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createEnumEntry(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrEnumEntrySymbol,
|
||||||
|
name: Name
|
||||||
|
): IrEnumEntry {
|
||||||
|
return super.createEnumEntry(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createErrorDeclaration(startOffset: Int, endOffset: Int, descriptor: DeclarationDescriptor?): IrErrorDeclaration {
|
||||||
|
return super.createErrorDeclaration(startOffset, endOffset, descriptor)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createField(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrFieldSymbol,
|
||||||
|
name: Name,
|
||||||
|
type: IrType,
|
||||||
|
visibility: DescriptorVisibility,
|
||||||
|
isFinal: Boolean,
|
||||||
|
isExternal: Boolean,
|
||||||
|
isStatic: Boolean
|
||||||
|
): IrField {
|
||||||
|
return super.createField(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
visibility,
|
||||||
|
isFinal,
|
||||||
|
isExternal,
|
||||||
|
isStatic,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createFunction(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrSimpleFunctionSymbol,
|
||||||
|
name: Name,
|
||||||
|
visibility: DescriptorVisibility,
|
||||||
|
modality: Modality,
|
||||||
|
returnType: IrType,
|
||||||
|
isInline: Boolean,
|
||||||
|
isExternal: Boolean,
|
||||||
|
isTailrec: Boolean,
|
||||||
|
isSuspend: Boolean,
|
||||||
|
isOperator: Boolean,
|
||||||
|
isInfix: Boolean,
|
||||||
|
isExpect: Boolean,
|
||||||
|
isFakeOverride: Boolean,
|
||||||
|
containerSource: DeserializedContainerSource?
|
||||||
|
): IrSimpleFunction {
|
||||||
|
return super.createFunction(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
visibility,
|
||||||
|
modality,
|
||||||
|
returnType,
|
||||||
|
isInline,
|
||||||
|
isExternal,
|
||||||
|
isTailrec,
|
||||||
|
isSuspend,
|
||||||
|
isOperator,
|
||||||
|
isInfix,
|
||||||
|
isExpect,
|
||||||
|
isFakeOverride,
|
||||||
|
containerSource,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createFakeOverrideFunction(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
name: Name,
|
||||||
|
visibility: DescriptorVisibility,
|
||||||
|
modality: Modality,
|
||||||
|
returnType: IrType,
|
||||||
|
isInline: Boolean,
|
||||||
|
isExternal: Boolean,
|
||||||
|
isTailrec: Boolean,
|
||||||
|
isSuspend: Boolean,
|
||||||
|
isOperator: Boolean,
|
||||||
|
isInfix: Boolean,
|
||||||
|
isExpect: Boolean
|
||||||
|
): IrSimpleFunction {
|
||||||
|
return super.createFakeOverrideFunction(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
name,
|
||||||
|
visibility,
|
||||||
|
modality,
|
||||||
|
returnType,
|
||||||
|
isInline,
|
||||||
|
isExternal,
|
||||||
|
isTailrec,
|
||||||
|
isSuspend,
|
||||||
|
isOperator,
|
||||||
|
isInfix,
|
||||||
|
isExpect,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createLocalDelegatedProperty(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrLocalDelegatedPropertySymbol,
|
||||||
|
name: Name,
|
||||||
|
type: IrType,
|
||||||
|
isVar: Boolean
|
||||||
|
): IrLocalDelegatedProperty {
|
||||||
|
return super.createLocalDelegatedProperty(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
isVar,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createProperty(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrPropertySymbol,
|
||||||
|
name: Name,
|
||||||
|
visibility: DescriptorVisibility,
|
||||||
|
modality: Modality,
|
||||||
|
isVar: Boolean,
|
||||||
|
isConst: Boolean,
|
||||||
|
isLateinit: Boolean,
|
||||||
|
isDelegated: Boolean,
|
||||||
|
isExternal: Boolean,
|
||||||
|
isExpect: Boolean,
|
||||||
|
isFakeOverride: Boolean,
|
||||||
|
containerSource: DeserializedContainerSource?
|
||||||
|
): IrProperty {
|
||||||
|
return super.createProperty(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
visibility,
|
||||||
|
modality,
|
||||||
|
isVar,
|
||||||
|
isConst,
|
||||||
|
isLateinit,
|
||||||
|
isDelegated,
|
||||||
|
isExternal,
|
||||||
|
isExpect,
|
||||||
|
isFakeOverride,
|
||||||
|
containerSource,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createFakeOverrideProperty(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
name: Name,
|
||||||
|
visibility: DescriptorVisibility,
|
||||||
|
modality: Modality,
|
||||||
|
isVar: Boolean,
|
||||||
|
isConst: Boolean,
|
||||||
|
isLateinit: Boolean,
|
||||||
|
isDelegated: Boolean,
|
||||||
|
isExternal: Boolean,
|
||||||
|
isExpect: Boolean
|
||||||
|
): IrProperty {
|
||||||
|
return super.createFakeOverrideProperty(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
name,
|
||||||
|
visibility,
|
||||||
|
modality,
|
||||||
|
isVar,
|
||||||
|
isConst,
|
||||||
|
isLateinit,
|
||||||
|
isDelegated,
|
||||||
|
isExternal,
|
||||||
|
isExpect,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createTypeAlias(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
symbol: IrTypeAliasSymbol,
|
||||||
|
name: Name,
|
||||||
|
visibility: DescriptorVisibility,
|
||||||
|
expandedType: IrType,
|
||||||
|
isActual: Boolean,
|
||||||
|
origin: IrDeclarationOrigin
|
||||||
|
): IrTypeAlias {
|
||||||
|
return super.createTypeAlias(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
visibility,
|
||||||
|
expandedType,
|
||||||
|
isActual,
|
||||||
|
origin,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createTypeParameter(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrTypeParameterSymbol,
|
||||||
|
name: Name,
|
||||||
|
index: Int,
|
||||||
|
isReified: Boolean,
|
||||||
|
variance: Variance
|
||||||
|
): IrTypeParameter {
|
||||||
|
return super.createTypeParameter(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
index,
|
||||||
|
isReified,
|
||||||
|
variance,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createValueParameter(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
origin: IrDeclarationOrigin,
|
||||||
|
symbol: IrValueParameterSymbol,
|
||||||
|
name: Name,
|
||||||
|
index: Int,
|
||||||
|
type: IrType,
|
||||||
|
varargElementType: IrType?,
|
||||||
|
isCrossinline: Boolean,
|
||||||
|
isNoinline: Boolean,
|
||||||
|
isHidden: Boolean,
|
||||||
|
isAssignable: Boolean
|
||||||
|
): IrValueParameter {
|
||||||
|
return super.createValueParameter(
|
||||||
|
startOffset,
|
||||||
|
endOffset,
|
||||||
|
origin,
|
||||||
|
symbol,
|
||||||
|
name,
|
||||||
|
index,
|
||||||
|
type,
|
||||||
|
varargElementType,
|
||||||
|
isCrossinline,
|
||||||
|
isNoinline,
|
||||||
|
isHidden,
|
||||||
|
isAssignable,
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-3
@@ -38,14 +38,12 @@ class IrFieldImpl(
|
|||||||
override val isFinal: Boolean,
|
override val isFinal: Boolean,
|
||||||
override val isExternal: Boolean,
|
override val isExternal: Boolean,
|
||||||
override val isStatic: Boolean,
|
override val isStatic: Boolean,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrField() {
|
) : IrField() {
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -37,8 +37,6 @@ abstract class IrFunctionCommonImpl(
|
|||||||
override val isExpect: Boolean,
|
override val isExpect: Boolean,
|
||||||
override val containerSource: DeserializedContainerSource?,
|
override val containerSource: DeserializedContainerSource?,
|
||||||
) : IrSimpleFunction() {
|
) : IrSimpleFunction() {
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
@@ -86,6 +84,7 @@ class IrFunctionImpl(
|
|||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||||
containerSource: DeserializedContainerSource? = null,
|
containerSource: DeserializedContainerSource? = null,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrFunctionCommonImpl(
|
) : IrFunctionCommonImpl(
|
||||||
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
||||||
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||||
@@ -115,6 +114,7 @@ class IrFakeOverrideFunctionImpl(
|
|||||||
isOperator: Boolean,
|
isOperator: Boolean,
|
||||||
isInfix: Boolean,
|
isInfix: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrFunctionCommonImpl(
|
) : IrFunctionCommonImpl(
|
||||||
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
||||||
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||||
|
|||||||
+2
-4
@@ -20,15 +20,13 @@ class IrLocalDelegatedPropertyImpl(
|
|||||||
override val symbol: IrLocalDelegatedPropertySymbol,
|
override val symbol: IrLocalDelegatedPropertySymbol,
|
||||||
override val name: Name,
|
override val name: Name,
|
||||||
override var type: IrType,
|
override var type: IrType,
|
||||||
override val isVar: Boolean
|
override val isVar: Boolean,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrLocalDelegatedProperty() {
|
) : IrLocalDelegatedProperty() {
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -42,8 +42,6 @@ abstract class IrPropertyCommonImpl(
|
|||||||
override val isExpect: Boolean,
|
override val isExpect: Boolean,
|
||||||
override val containerSource: DeserializedContainerSource?,
|
override val containerSource: DeserializedContainerSource?,
|
||||||
) : IrProperty() {
|
) : IrProperty() {
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
@@ -77,6 +75,7 @@ class IrPropertyImpl(
|
|||||||
isExpect: Boolean = false,
|
isExpect: Boolean = false,
|
||||||
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||||
containerSource: DeserializedContainerSource? = null,
|
containerSource: DeserializedContainerSource? = null,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrPropertyCommonImpl(
|
) : IrPropertyCommonImpl(
|
||||||
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||||
containerSource
|
containerSource
|
||||||
@@ -103,6 +102,7 @@ class IrFakeOverridePropertyImpl(
|
|||||||
isDelegated: Boolean,
|
isDelegated: Boolean,
|
||||||
isExternal: Boolean,
|
isExternal: Boolean,
|
||||||
isExpect: Boolean,
|
isExpect: Boolean,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrPropertyCommonImpl(
|
) : IrPropertyCommonImpl(
|
||||||
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||||
containerSource = null,
|
containerSource = null,
|
||||||
|
|||||||
+2
-4
@@ -22,15 +22,13 @@ class IrTypeAliasImpl(
|
|||||||
override var visibility: DescriptorVisibility,
|
override var visibility: DescriptorVisibility,
|
||||||
override var expandedType: IrType,
|
override var expandedType: IrType,
|
||||||
override val isActual: Boolean,
|
override val isActual: Boolean,
|
||||||
override var origin: IrDeclarationOrigin
|
override var origin: IrDeclarationOrigin,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrTypeAlias() {
|
) : IrTypeAlias() {
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -36,15 +36,13 @@ class IrTypeParameterImpl(
|
|||||||
override val name: Name,
|
override val name: Name,
|
||||||
override val index: Int,
|
override val index: Int,
|
||||||
override val isReified: Boolean,
|
override val isReified: Boolean,
|
||||||
override val variance: Variance
|
override val variance: Variance,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrTypeParameter() {
|
) : IrTypeParameter() {
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -40,7 +40,8 @@ class IrValueParameterImpl(
|
|||||||
override val isCrossinline: Boolean,
|
override val isCrossinline: Boolean,
|
||||||
override val isNoinline: Boolean,
|
override val isNoinline: Boolean,
|
||||||
override val isHidden: Boolean,
|
override val isHidden: Boolean,
|
||||||
override val isAssignable: Boolean
|
override val isAssignable: Boolean,
|
||||||
|
override val factory: IrFactory = IrFactoryImpl,
|
||||||
) : IrValueParameter() {
|
) : IrValueParameter() {
|
||||||
@ObsoleteDescriptorBasedAPI
|
@ObsoleteDescriptorBasedAPI
|
||||||
override val descriptor: ParameterDescriptor
|
override val descriptor: ParameterDescriptor
|
||||||
@@ -50,9 +51,6 @@ class IrValueParameterImpl(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val factory: IrFactory
|
|
||||||
get() = IrFactoryImpl
|
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
override var annotations: List<IrConstructorCall> = emptyList()
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
|
|||||||
@@ -34,4 +34,8 @@ open class StageController(open val currentStage: Int = 0) {
|
|||||||
open fun createSignature(parentSignature: IdSignature): IdSignature? = null
|
open fun createSignature(parentSignature: IdSignature): IdSignature? = null
|
||||||
|
|
||||||
open val currentDeclaration: IrDeclaration? get() = null
|
open val currentDeclaration: IrDeclaration? get() = null
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IdSignatureRetriever {
|
||||||
|
fun declarationSignature(declaration: IrDeclaration): IdSignature?
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user