[IR] Unbind construction methods of IrVariableImpl from symbol.descriptor
This commit is contained in:
+3
-3
@@ -127,9 +127,9 @@ class LateinitUsageLowering(val backendContext: CommonBackendContext) : BodyLowe
|
||||
IrVariableSymbolImpl(descriptor),
|
||||
declaration.name,
|
||||
type,
|
||||
true,
|
||||
false,
|
||||
true
|
||||
isVar = true,
|
||||
isConst = false,
|
||||
isLateinit = true
|
||||
).also {
|
||||
descriptor.bind(it)
|
||||
it.parent = declaration.parent
|
||||
|
||||
+3
-3
@@ -58,9 +58,9 @@ class JsSharedVariablesManager(val builtIns: IrBuiltIns, val implicitDeclaration
|
||||
IrVariableSymbolImpl(descriptor),
|
||||
originalDeclaration.name,
|
||||
irCall.type,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
isVar = false,
|
||||
isConst = false,
|
||||
isLateinit = false
|
||||
).also {
|
||||
descriptor.bind(it)
|
||||
it.parent = originalDeclaration.parent
|
||||
|
||||
+14
-21
@@ -29,18 +29,17 @@ import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
|
||||
class IrVariableImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrVariableSymbol,
|
||||
override val name: Name = symbol.descriptor.name,
|
||||
override val name: Name,
|
||||
override val type: IrType,
|
||||
override val isVar: Boolean = symbol.descriptor.isVar,
|
||||
override val isConst: Boolean = symbol.descriptor.isConst,
|
||||
override val isLateinit: Boolean = symbol.descriptor.isLateInit
|
||||
override val isVar: Boolean,
|
||||
override val isConst: Boolean,
|
||||
override val isLateinit: Boolean
|
||||
) : IrVariable {
|
||||
|
||||
private var _parent: IrDeclarationParent? = null
|
||||
@@ -54,27 +53,21 @@ class IrVariableImpl(
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
override val metadata: MetadataSource? get() = null
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrVariableSymbol,
|
||||
type: IrType
|
||||
) : this(
|
||||
startOffset, endOffset, origin, symbol,
|
||||
symbol.descriptor.name, type,
|
||||
isVar = symbol.descriptor.isVar,
|
||||
isConst = symbol.descriptor.isConst,
|
||||
isLateinit = symbol.descriptor.isLateInit
|
||||
)
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
descriptor: VariableDescriptor,
|
||||
type: IrType
|
||||
) : this(startOffset, endOffset, origin, IrVariableSymbolImpl(descriptor), type)
|
||||
type: IrType,
|
||||
name: Name = descriptor.name,
|
||||
symbol: IrVariableSymbol = IrVariableSymbolImpl(descriptor)
|
||||
) : this(
|
||||
startOffset, endOffset, origin,
|
||||
symbol, name, type,
|
||||
isVar = descriptor.isVar,
|
||||
isConst = descriptor.isConst,
|
||||
isLateinit = descriptor.isLateInit
|
||||
)
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
|
||||
@@ -840,7 +840,7 @@ open class SymbolTable(
|
||||
descriptor: VariableDescriptor,
|
||||
type: IrType,
|
||||
variableFactory: (IrVariableSymbol) -> IrVariable = {
|
||||
IrVariableImpl(startOffset, endOffset, origin, it, nameProvider.nameForDeclaration(descriptor), type)
|
||||
IrVariableImpl(startOffset, endOffset, origin, descriptor, type, nameProvider.nameForDeclaration(descriptor), it)
|
||||
}
|
||||
|
||||
): IrVariable =
|
||||
|
||||
Reference in New Issue
Block a user