IR: cleanup expression implementations
Remove unused constructors with descriptors, minimize usages of secondary constructors and make some properties non-lateinit, fix some inspections.
This commit is contained in:
@@ -847,9 +847,7 @@ class Fir2IrVisitor(
|
||||
override fun visitCatch(catch: FirCatch, data: Any?): IrElement {
|
||||
return catch.convertWithOffsets { startOffset, endOffset ->
|
||||
val catchParameter = declarationStorage.createIrVariable(catch.parameter, conversionScope.parentFromStack())
|
||||
IrCatchImpl(startOffset, endOffset, catchParameter).apply {
|
||||
result = catch.block.convertToIrExpressionOrBlock()
|
||||
}
|
||||
IrCatchImpl(startOffset, endOffset, catchParameter, catch.block.convertToIrExpressionOrBlock())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -273,9 +273,9 @@ class CallAndReferenceGenerator(
|
||||
val fir = calleeReference.resolvedSymbol.fir
|
||||
if (this is FirFunctionCall && fir is FirSimpleFunction && fir.origin == FirDeclarationOrigin.SamConstructor) {
|
||||
return convertWithOffsets { startOffset, endOffset ->
|
||||
IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.SAM_CONVERSION, type).apply {
|
||||
argument = visitor.convertToIrExpression(this@tryConvertToSamConstructorCall.argument)
|
||||
}
|
||||
IrTypeOperatorCallImpl(
|
||||
startOffset, endOffset, type, IrTypeOperator.SAM_CONVERSION, type, visitor.convertToIrExpression(argument)
|
||||
)
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
||||
+4
-3
@@ -220,12 +220,13 @@ class FinallyBlocksLowering(val context: CommonBackendContext, private val throw
|
||||
endOffset = endOffset,
|
||||
type = context.irBuiltIns.unitType
|
||||
).apply {
|
||||
this.catches += irCatch(catchParameter).apply {
|
||||
result = irComposite {
|
||||
this.catches += irCatch(
|
||||
catchParameter,
|
||||
irComposite {
|
||||
+finallyExpression.copy()
|
||||
+irThrow(irGet(catchParameter))
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
this.finallyExpression = null
|
||||
}
|
||||
|
||||
+2
-5
@@ -111,11 +111,8 @@ fun IrBuilderWithScope.irNot(arg: IrExpression) =
|
||||
fun IrBuilderWithScope.irThrow(arg: IrExpression) =
|
||||
IrThrowImpl(startOffset, endOffset, context.irBuiltIns.nothingType, arg)
|
||||
|
||||
fun IrBuilderWithScope.irCatch(catchParameter: IrVariable) =
|
||||
IrCatchImpl(
|
||||
startOffset, endOffset,
|
||||
catchParameter
|
||||
)
|
||||
fun IrBuilderWithScope.irCatch(catchParameter: IrVariable, result: IrExpression): IrCatch =
|
||||
IrCatchImpl(startOffset, endOffset, catchParameter, result)
|
||||
|
||||
fun IrBuilderWithScope.irImplicitCoercionToUnit(arg: IrExpression) =
|
||||
IrTypeOperatorCallImpl(
|
||||
|
||||
+2
-2
@@ -92,9 +92,9 @@ class JsSuspendFunctionsLowering(ctx: JsIrBackendContext) : AbstractSuspendFunct
|
||||
body.endOffset,
|
||||
unit,
|
||||
COROUTINE_ROOT_LOOP,
|
||||
rootTry,
|
||||
JsIrBuilder.buildBoolean(context.irBuiltIns.booleanType, true)
|
||||
).also {
|
||||
it.condition = JsIrBuilder.buildBoolean(context.irBuiltIns.booleanType, true)
|
||||
it.body = rootTry
|
||||
it.label = "\$sm"
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -455,10 +455,10 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F
|
||||
valueMap[expression.symbol]?.let {
|
||||
return IrSetVariableImpl(
|
||||
expression.startOffset, expression.endOffset,
|
||||
it.type, it.symbol as IrVariableSymbol, expression.origin
|
||||
).apply {
|
||||
value = expression.value.transform(this@JvmInlineClassLowering, null)
|
||||
}
|
||||
it.type, it.symbol as IrVariableSymbol,
|
||||
expression.value.transform(this@JvmInlineClassLowering, null),
|
||||
expression.origin
|
||||
)
|
||||
}
|
||||
return super.visitSetVariable(expression)
|
||||
}
|
||||
|
||||
+1
-8
@@ -167,14 +167,7 @@ private fun StatementGenerator.generateThisOrSuperReceiver(receiver: ReceiverVal
|
||||
fun IrExpression.implicitCastTo(expectedType: IrType?): IrExpression {
|
||||
if (expectedType == null) return this
|
||||
|
||||
return IrTypeOperatorCallImpl(
|
||||
startOffset, endOffset,
|
||||
expectedType,
|
||||
IrTypeOperator.IMPLICIT_CAST,
|
||||
expectedType
|
||||
).also {
|
||||
it.argument = this
|
||||
}
|
||||
return IrTypeOperatorCallImpl(startOffset, endOffset, expectedType, IrTypeOperator.IMPLICIT_CAST, expectedType, this)
|
||||
}
|
||||
|
||||
fun StatementGenerator.generateBackingFieldReceiver(
|
||||
|
||||
@@ -159,9 +159,12 @@ class CallGenerator(statementGenerator: StatementGenerator) : StatementGenerator
|
||||
return call.callReceiver.call { dispatchReceiver, extensionReceiver ->
|
||||
if (dispatchReceiver != null) throw AssertionError("Dispatch receiver should be null: $dispatchReceiver")
|
||||
if (extensionReceiver != null) throw AssertionError("Extension receiver should be null: $extensionReceiver")
|
||||
val constructorSymbol = context.symbolTable.referenceConstructor(constructorDescriptor.original)
|
||||
val descriptor = constructorDescriptor.original
|
||||
val constructorSymbol = context.symbolTable.referenceConstructor(descriptor)
|
||||
val returnType = constructorDescriptor.returnType.toIrType()
|
||||
val irCall = IrEnumConstructorCallImpl(startOffset, endOffset, returnType, constructorSymbol)
|
||||
val irCall = IrEnumConstructorCallImpl(
|
||||
startOffset, endOffset, returnType, constructorSymbol, descriptor.typeParametersCount, descriptor.valueParameters.size
|
||||
)
|
||||
context.callToSubstitutedDescriptorMap[irCall] = constructorDescriptor
|
||||
addParametersToCall(startOffset, endOffset, call, irCall, irCall.type)
|
||||
}
|
||||
|
||||
+4
-5
@@ -43,10 +43,9 @@ class TryCatchExpressionGenerator(statementGenerator: StatementGenerator) : Stat
|
||||
ktCatchParameter.startOffsetSkippingComments, ktCatchParameter.endOffset,
|
||||
IrDeclarationOrigin.CATCH_PARAMETER,
|
||||
catchParameterDescriptor, catchParameterDescriptor.type.toIrType()
|
||||
)
|
||||
).apply {
|
||||
result = ktCatchBody.genExpr()
|
||||
}
|
||||
),
|
||||
ktCatchBody.genExpr()
|
||||
)
|
||||
|
||||
irTryCatch.catches.add(irCatch)
|
||||
}
|
||||
@@ -55,4 +54,4 @@ class TryCatchExpressionGenerator(statementGenerator: StatementGenerator) : Stat
|
||||
|
||||
return irTryCatch
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -87,7 +87,7 @@ internal class InsertImplicitCasts(
|
||||
element.acceptChildrenVoid(object : IrElementVisitorVoid {
|
||||
override fun visitReturn(expression: IrReturn) {
|
||||
super.visitReturn(expression)
|
||||
val expectedReturnType = expectedFunctionExpressionReturnType[expression.returnTarget] ?: return
|
||||
val expectedReturnType = expectedFunctionExpressionReturnType[expression.returnTargetSymbol.descriptor] ?: return
|
||||
expression.value = expression.value.cast(expectedReturnType)
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ internal class InsertImplicitCasts(
|
||||
value = if (expression.returnTargetSymbol is IrConstructorSymbol) {
|
||||
value.coerceToUnit(irBuiltIns)
|
||||
} else {
|
||||
val returnTargetDescriptor = expression.returnTarget
|
||||
val returnTargetDescriptor = expression.returnTargetSymbol.descriptor
|
||||
val isLambdaReturnValue = returnTargetDescriptor is AnonymousFunctionDescriptor
|
||||
value.cast(returnTargetDescriptor.returnType, isLambdaReturnValue = isLambdaReturnValue)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.ir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrReturnTarget
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSymbolOwner
|
||||
import org.jetbrains.kotlin.ir.declarations.name
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrReturnableBlockSymbol
|
||||
@@ -46,8 +45,3 @@ interface IrReturnableBlock : IrBlock, IrSymbolOwner, IrReturnTarget {
|
||||
|
||||
val IrReturnableBlock.sourceFileSymbol: IrFileSymbol?
|
||||
get() = inlineFunctionSymbol?.owner?.file?.symbol
|
||||
|
||||
@Deprecated("Please avoid using it")
|
||||
val IrReturnableBlock.sourceFileName: String
|
||||
get() = sourceFileSymbol?.owner?.name ?: "no source file"
|
||||
|
||||
|
||||
-3
@@ -16,11 +16,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
|
||||
interface IrInstanceInitializerCall : IrExpression {
|
||||
val classDescriptor: ClassDescriptor
|
||||
val classSymbol: IrClassSymbol
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.ir.symbols.IrReturnTargetSymbol
|
||||
|
||||
|
||||
interface IrReturn : IrExpression {
|
||||
var value: IrExpression
|
||||
val returnTarget: FunctionDescriptor
|
||||
val returnTargetSymbol: IrReturnTargetSymbol
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
@@ -31,9 +29,6 @@ interface IrTry : IrExpression {
|
||||
}
|
||||
|
||||
interface IrCatch : IrElement {
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
val parameter: VariableDescriptor
|
||||
|
||||
var catchParameter: IrVariable
|
||||
var result: IrExpression
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBlock
|
||||
import org.jetbrains.kotlin.ir.expressions.IrReturnableBlock
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
@@ -43,7 +44,7 @@ class IrBlockImpl(
|
||||
origin: IrStatementOrigin?,
|
||||
statements: List<IrStatement>
|
||||
) :
|
||||
this(startOffset, endOffset, type, origin) {
|
||||
this(startOffset, endOffset, type, origin) {
|
||||
this.statements.addAll(statements)
|
||||
}
|
||||
|
||||
@@ -64,18 +65,19 @@ fun IrBlockImpl.inlineStatement(statement: IrStatement) {
|
||||
}
|
||||
|
||||
class IrReturnableBlockImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val symbol: IrReturnableBlockSymbol,
|
||||
origin: IrStatementOrigin? = null,
|
||||
override val inlineFunctionSymbol: IrFunctionSymbol? = null
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val symbol: IrReturnableBlockSymbol,
|
||||
origin: IrStatementOrigin? = null,
|
||||
override val inlineFunctionSymbol: IrFunctionSymbol? = null
|
||||
) :
|
||||
IrContainerExpressionBase(startOffset, endOffset, type, origin),
|
||||
IrReturnableBlock {
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor = symbol.descriptor
|
||||
override val descriptor: FunctionDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
|
||||
+1
-14
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrDoWhileLoop
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
@@ -32,18 +31,6 @@ class IrDoWhileLoopImpl(
|
||||
IrLoopBase(startOffset, endOffset, type, origin),
|
||||
IrDoWhileLoop {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
body: IrExpression,
|
||||
condition: IrExpression
|
||||
) : this(startOffset, endOffset, type, origin) {
|
||||
this.condition = condition
|
||||
this.body = body
|
||||
}
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
return visitor.visitDoWhileLoop(this, data)
|
||||
}
|
||||
@@ -57,4 +44,4 @@ class IrDoWhileLoopImpl(
|
||||
body = body?.transform(transformer, data)
|
||||
condition = condition.transform(transformer, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-9
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.expressions.IrEnumConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.typeParametersCount
|
||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
@@ -40,14 +39,6 @@ class IrEnumConstructorCallImpl(
|
||||
),
|
||||
IrEnumConstructorCall {
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
symbol: IrConstructorSymbol
|
||||
) : this(startOffset, endOffset, type, symbol, symbol.descriptor.typeParametersCount, symbol.descriptor.valueParameters.size)
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
|
||||
@@ -26,5 +26,6 @@ abstract class IrExpressionBase(
|
||||
endOffset: Int,
|
||||
override val type: IrType
|
||||
) : IrElementBase(startOffset, endOffset), IrExpression {
|
||||
@Suppress("LeakingThis")
|
||||
override var attributeOwnerId: IrAttributeContainer = this
|
||||
}
|
||||
|
||||
@@ -25,17 +25,12 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
class IrGetClassImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType
|
||||
type: IrType,
|
||||
override var argument: IrExpression,
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrGetClass {
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, type: IrType, argument: IrExpression) : this(startOffset, endOffset, type) {
|
||||
this.argument = argument
|
||||
}
|
||||
|
||||
override lateinit var argument: IrExpression
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
return visitor.visitGetClass(this, data)
|
||||
}
|
||||
@@ -47,4 +42,4 @@ class IrGetClassImpl(
|
||||
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
|
||||
argument = argument.transform(transformer, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-5
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.expressions.IrInstanceInitializerCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
@@ -32,9 +30,6 @@ class IrInstanceInitializerCallImpl(
|
||||
IrTerminalExpressionBase(startOffset, endOffset, type),
|
||||
IrInstanceInitializerCall {
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val classDescriptor: ClassDescriptor get() = classSymbol.descriptor
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
return visitor.visitInstanceInitializerCall(this, data)
|
||||
}
|
||||
|
||||
-19
@@ -16,14 +16,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrPropertyReference
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrPropertySymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -42,23 +40,6 @@ class IrPropertyReferenceImpl(
|
||||
IrMemberAccessExpressionBase<IrPropertySymbol>(startOffset, endOffset, type, typeArgumentsCount, 0, origin),
|
||||
IrPropertyReference {
|
||||
|
||||
@Deprecated(message = "Don't use descriptor-based API for IrPropertyReference", level = DeprecationLevel.WARNING)
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
descriptor: PropertyDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
field: IrFieldSymbol?,
|
||||
getter: IrSimpleFunctionSymbol?,
|
||||
setter: IrSimpleFunctionSymbol?,
|
||||
origin: IrStatementOrigin? = null
|
||||
) : this(
|
||||
startOffset, endOffset, type,
|
||||
IrPropertySymbolImpl(descriptor),
|
||||
typeArgumentsCount, field, getter, setter, origin
|
||||
)
|
||||
|
||||
override val referencedName: Name
|
||||
get() = symbol.owner.name
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrReturn
|
||||
import org.jetbrains.kotlin.ir.symbols.IrReturnTargetSymbol
|
||||
@@ -35,9 +33,6 @@ class IrReturnImpl(
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrReturn {
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val returnTarget: FunctionDescriptor get() = returnTargetSymbol.descriptor
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitReturn(this, data)
|
||||
|
||||
|
||||
+1
-14
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrSetVariable
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
@@ -30,24 +29,12 @@ class IrSetVariableImpl(
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val symbol: IrVariableSymbol,
|
||||
override var value: IrExpression,
|
||||
override val origin: IrStatementOrigin?
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrSetVariable {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
symbol: IrVariableSymbol,
|
||||
value: IrExpression,
|
||||
origin: IrStatementOrigin?
|
||||
) : this(startOffset, endOffset, type, symbol, origin) {
|
||||
this.value = value
|
||||
}
|
||||
|
||||
override lateinit var value: IrExpression
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
return visitor.visitSetVariable(this, data)
|
||||
}
|
||||
|
||||
+3
-8
@@ -24,17 +24,12 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
|
||||
class IrSpreadElementImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int
|
||||
endOffset: Int,
|
||||
override var expression: IrExpression,
|
||||
) :
|
||||
IrElementBase(startOffset, endOffset),
|
||||
IrSpreadElement {
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, expression: IrExpression) : this(startOffset, endOffset) {
|
||||
this.expression = expression
|
||||
}
|
||||
|
||||
override lateinit var expression: IrExpression
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
return visitor.visitSpreadElement(this, data)
|
||||
}
|
||||
@@ -46,4 +41,4 @@ class IrSpreadElementImpl(
|
||||
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
|
||||
expression = expression.transform(transformer, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,22 +25,12 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
class IrThrowImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType
|
||||
type: IrType,
|
||||
override var value: IrExpression,
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrThrow {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
value: IrExpression
|
||||
) : this(startOffset, endOffset, type) {
|
||||
this.value = value
|
||||
}
|
||||
|
||||
override lateinit var value: IrExpression
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitThrow(this, data)
|
||||
|
||||
@@ -51,4 +41,4 @@ class IrThrowImpl(
|
||||
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
|
||||
value = value.transform(transformer, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.IrElementBase
|
||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.expressions.IrCatch
|
||||
@@ -76,19 +74,12 @@ class IrTryImpl(
|
||||
|
||||
class IrCatchImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int
|
||||
endOffset: Int,
|
||||
override var catchParameter: IrVariable,
|
||||
) :
|
||||
IrElementBase(startOffset, endOffset),
|
||||
IrCatch {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
catchParameter: IrVariable
|
||||
) : this(startOffset, endOffset) {
|
||||
this.catchParameter = catchParameter
|
||||
}
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
@@ -98,12 +89,8 @@ class IrCatchImpl(
|
||||
this.result = result
|
||||
}
|
||||
|
||||
override lateinit var catchParameter: IrVariable
|
||||
override lateinit var result: IrExpression
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val parameter: VariableDescriptor get() = catchParameter.descriptor
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
return visitor.visitCatch(this, data)
|
||||
}
|
||||
@@ -117,4 +104,4 @@ class IrCatchImpl(
|
||||
catchParameter = catchParameter.transform(transformer, data) as IrVariable
|
||||
result = result.transform(transformer, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-28
@@ -30,40 +30,15 @@ class IrTypeOperatorCallImpl(
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val operator: IrTypeOperator,
|
||||
override val typeOperand: IrType
|
||||
override val typeOperand: IrType,
|
||||
override var argument: IrExpression,
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrTypeOperatorCall {
|
||||
|
||||
override lateinit var argument: IrExpression
|
||||
|
||||
override val typeOperandClassifier: IrClassifierSymbol
|
||||
get() = typeOperand.classifierOrFail
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
operator: IrTypeOperator,
|
||||
typeOperand: IrType,
|
||||
argument: IrExpression
|
||||
) : this(startOffset, endOffset, type, operator, typeOperand) {
|
||||
this.argument = argument
|
||||
}
|
||||
|
||||
@Deprecated("Doesn't require typeOperandClassifier")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
operator: IrTypeOperator,
|
||||
typeOperand: IrType,
|
||||
typeOperandClassifier: IrClassifierSymbol,
|
||||
argument: IrExpression
|
||||
) : this(startOffset, endOffset, type, operator, typeOperand) {
|
||||
this.argument = argument
|
||||
}
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitTypeOperator(this, data)
|
||||
|
||||
@@ -74,4 +49,4 @@ class IrTypeOperatorCallImpl(
|
||||
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
|
||||
argument = argument.transform(transformer, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -673,9 +673,7 @@ abstract class IrFileDeserializer(
|
||||
val operator = deserializeTypeOperator(proto.operator)
|
||||
val operand = deserializeIrType(proto.operand)//.brokenIr
|
||||
val argument = deserializeExpression(proto.argument)
|
||||
return IrTypeOperatorCallImpl(start, end, type, operator, operand).apply {
|
||||
this.argument = argument
|
||||
}
|
||||
return IrTypeOperatorCallImpl(start, end, type, operator, operand, argument)
|
||||
}
|
||||
|
||||
private fun deserializeVararg(proto: ProtoVararg, start: Int, end: Int, type: IrType): IrVararg {
|
||||
|
||||
Reference in New Issue
Block a user