IR expressions: KotlinType -> IrType
This commit is contained in:
+7
-8
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
||||
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.resolve.calls.components.isVararg
|
||||
@@ -25,7 +26,7 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import java.util.*
|
||||
|
||||
private class IrEmptyVarargExpression(
|
||||
override val type: KotlinType,
|
||||
override val type: IrType,
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int
|
||||
) : IrExpression {
|
||||
@@ -122,13 +123,11 @@ open class IrIntrinsicFunction(
|
||||
}
|
||||
}
|
||||
|
||||
fun createWithResult(
|
||||
expression: IrMemberAccessExpression,
|
||||
signature: JvmMethodSignature,
|
||||
context: JvmBackendContext,
|
||||
argsTypes: List<Type> = expression.argTypes(context),
|
||||
invokeInstruction: IrIntrinsicFunction.(InstructionAdapter) -> Type
|
||||
): IrIntrinsicFunction {
|
||||
fun createWithResult(expression: IrMemberAccessExpression,
|
||||
signature: JvmMethodSignature,
|
||||
context: JvmBackendContext,
|
||||
argsTypes: List<Type> = expression.argTypes(context),
|
||||
invokeInstruction: IrIntrinsicFunction.(InstructionAdapter) -> Type): IrIntrinsicFunction {
|
||||
return object : IrIntrinsicFunction(expression, signature, context, argsTypes) {
|
||||
|
||||
override fun genInvokeInstructionWithResult(v: InstructionAdapter) = invokeInstruction(v)
|
||||
|
||||
@@ -18,12 +18,12 @@ package org.jetbrains.kotlin.ir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
|
||||
|
||||
interface IrClassReference : IrDeclarationReference {
|
||||
override val descriptor: ClassifierDescriptor
|
||||
override val symbol: IrClassifierSymbol
|
||||
val classType: KotlinType
|
||||
val classType: IrType
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
package org.jetbrains.kotlin.ir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
interface IrExpression : IrStatement, IrVarargElement {
|
||||
val type: KotlinType
|
||||
val type: IrType
|
||||
|
||||
override fun <D> transform(transformer: IrElementTransformer<D>, data: D): IrExpression =
|
||||
accept(transformer, data) as IrExpression
|
||||
|
||||
+4
-17
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.ir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
|
||||
interface IrMemberAccessExpression : IrExpression {
|
||||
var dispatchReceiver: IrExpression?
|
||||
@@ -28,8 +28,8 @@ interface IrMemberAccessExpression : IrExpression {
|
||||
val origin: IrStatementOrigin?
|
||||
|
||||
val typeArgumentsCount: Int
|
||||
fun getTypeArgument(index: Int): KotlinType?
|
||||
fun putTypeArgument(index: Int, type: KotlinType?)
|
||||
fun getTypeArgument(index: Int): IrType?
|
||||
fun putTypeArgument(index: Int, type: IrType?)
|
||||
|
||||
val valueArgumentsCount: Int
|
||||
fun getValueArgument(index: Int): IrExpression?
|
||||
@@ -37,7 +37,7 @@ interface IrMemberAccessExpression : IrExpression {
|
||||
fun removeValueArgument(index: Int)
|
||||
}
|
||||
|
||||
fun IrMemberAccessExpression.getTypeArgument(typeParameterDescriptor: TypeParameterDescriptor): KotlinType? =
|
||||
fun IrMemberAccessExpression.getTypeArgument(typeParameterDescriptor: TypeParameterDescriptor): IrType? =
|
||||
getTypeArgument(typeParameterDescriptor.index)
|
||||
|
||||
fun IrMemberAccessExpression.copyTypeArgumentsFrom(other: IrMemberAccessExpression) {
|
||||
@@ -49,19 +49,6 @@ fun IrMemberAccessExpression.copyTypeArgumentsFrom(other: IrMemberAccessExpressi
|
||||
}
|
||||
}
|
||||
|
||||
fun IrMemberAccessExpression.copyTypeArgumentsFrom(source: Map<TypeParameterDescriptor, KotlinType>?) {
|
||||
if (source == null) return
|
||||
for ((typeParameter, typeArgument) in source) {
|
||||
val index = typeParameter.index
|
||||
assert(index < typeArgumentsCount) {
|
||||
"Index out of range for type parameter $typeParameter; " +
|
||||
"containingDeclaration: ${typeParameter.containingDeclaration}; " +
|
||||
"callee: $descriptor"
|
||||
}
|
||||
putTypeArgument(index, typeArgument)
|
||||
}
|
||||
}
|
||||
|
||||
val CallableDescriptor.typeArgumentsCount: Int
|
||||
get() =
|
||||
when (this) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.ir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
|
||||
enum class IrTypeOperator {
|
||||
CAST,
|
||||
@@ -33,7 +33,7 @@ enum class IrTypeOperator {
|
||||
interface IrTypeOperatorCall : IrExpression {
|
||||
val operator: IrTypeOperator
|
||||
var argument: IrExpression
|
||||
val typeOperand: KotlinType
|
||||
val typeOperand: IrType
|
||||
val typeOperandClassifier: IrClassifierSymbol
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
package org.jetbrains.kotlin.ir.expressions
|
||||
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
interface IrVarargElement : IrElement
|
||||
|
||||
interface IrVararg : IrExpression {
|
||||
val varargElementType: KotlinType
|
||||
val varargElementType: IrType
|
||||
|
||||
val elements: List<IrVarargElement>
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import java.util.*
|
||||
|
||||
class IrBlockBodyImpl(startOffset: Int, endOffset: Int) : IrElementBase(startOffset, endOffset), IrBlockBody {
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, statements: List<IrStatement>) : this(startOffset, endOffset) {
|
||||
this.statements.addAll(statements)
|
||||
}
|
||||
|
||||
@@ -23,13 +23,26 @@ import org.jetbrains.kotlin.ir.expressions.IrReturnableBlock
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.IrReturnableBlockSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrReturnableBlockSymbolImpl
|
||||
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.types.KotlinType
|
||||
|
||||
class IrBlockImpl(startOffset: Int, endOffset: Int, type: KotlinType, origin: IrStatementOrigin? = null) :
|
||||
IrContainerExpressionBase(startOffset, endOffset, type, origin), IrBlock {
|
||||
constructor(startOffset: Int, endOffset: Int, type: KotlinType, origin: IrStatementOrigin?, statements: List<IrStatement>) :
|
||||
class IrBlockImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null
|
||||
) :
|
||||
IrContainerExpressionBase(startOffset, endOffset, type, origin),
|
||||
IrBlock {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
statements: List<IrStatement>
|
||||
) :
|
||||
this(startOffset, endOffset, type, origin) {
|
||||
this.statements.addAll(statements)
|
||||
}
|
||||
@@ -52,35 +65,48 @@ fun IrBlockImpl.inlineStatement(statement: IrStatement) {
|
||||
|
||||
|
||||
class IrReturnableBlockImpl(
|
||||
startOffset: Int, endOffset: Int, type: KotlinType,
|
||||
override val symbol: IrReturnableBlockSymbol, origin: IrStatementOrigin? = null, override val sourceFileName: String = "no source file"
|
||||
) : IrContainerExpressionBase(startOffset, endOffset, type, origin), IrReturnableBlock {
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val symbol: IrReturnableBlockSymbol,
|
||||
origin: IrStatementOrigin? = null,
|
||||
override val sourceFileName: String = "no source file"
|
||||
) :
|
||||
IrContainerExpressionBase(startOffset, endOffset, type, origin),
|
||||
IrReturnableBlock {
|
||||
|
||||
override val descriptor = symbol.descriptor
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
symbol: IrReturnableBlockSymbol,
|
||||
origin: IrStatementOrigin?,
|
||||
statements: List<IrStatement>,
|
||||
sourceFileName: String = "no source file"
|
||||
) :
|
||||
this(startOffset, endOffset, type, symbol, origin, sourceFileName) {
|
||||
) : this(startOffset, endOffset, type, symbol, origin, sourceFileName) {
|
||||
this.statements.addAll(statements)
|
||||
}
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, type: KotlinType,
|
||||
descriptor: FunctionDescriptor, origin: IrStatementOrigin? = null, sourceFileName: String = "no source file"
|
||||
) :
|
||||
this(startOffset, endOffset, type, IrReturnableBlockSymbolImpl(descriptor), origin, sourceFileName)
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
descriptor: FunctionDescriptor,
|
||||
origin: IrStatementOrigin? = null,
|
||||
sourceFileName: String = "no source file"
|
||||
) : this(startOffset, endOffset, type, IrReturnableBlockSymbolImpl(descriptor), origin, sourceFileName)
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, type: KotlinType,
|
||||
descriptor: FunctionDescriptor, origin: IrStatementOrigin?, statements: List<IrStatement>, sourceFileName: String = "no source file"
|
||||
) :
|
||||
this(startOffset, endOffset, type, descriptor, origin, sourceFileName) {
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
descriptor: FunctionDescriptor,
|
||||
origin: IrStatementOrigin?,
|
||||
statements: List<IrStatement>,
|
||||
sourceFileName: String = "no source file"
|
||||
) : this(startOffset, endOffset, type, descriptor, origin, sourceFileName) {
|
||||
this.statements.addAll(statements)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,12 +18,12 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBreakContinue
|
||||
import org.jetbrains.kotlin.ir.expressions.IrLoop
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
|
||||
abstract class IrBreakContinueBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override var loop: IrLoop
|
||||
) : IrTerminalExpressionBase(startOffset, endOffset, type), IrBreakContinue {
|
||||
override var label: String? = null
|
||||
|
||||
@@ -18,13 +18,13 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBreak
|
||||
import org.jetbrains.kotlin.ir.expressions.IrLoop
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrBreakImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
loop: IrLoop
|
||||
) : IrBreakContinueBase(startOffset, endOffset, type, loop), IrBreak {
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
|
||||
@@ -18,22 +18,20 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.expressions.copyTypeArgumentsFrom
|
||||
import org.jetbrains.kotlin.ir.expressions.typeArgumentsCount
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createClassSymbolOrNull
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrCallImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val symbol: IrFunctionSymbol,
|
||||
override val descriptor: FunctionDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
@@ -51,21 +49,18 @@ class IrCallImpl(
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
symbol: IrFunctionSymbol,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>?,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : this(startOffset, endOffset, type, symbol, descriptor, descriptor.typeArgumentsCount, origin, superQualifierSymbol) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
) : this(startOffset, endOffset, type, symbol, descriptor, descriptor.typeArgumentsCount, origin, superQualifierSymbol)
|
||||
|
||||
@Deprecated("Creates unbound symbols")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
origin: IrStatementOrigin? = null,
|
||||
@@ -80,69 +75,8 @@ class IrCallImpl(
|
||||
createClassSymbolOrNull(superQualifierDescriptor)
|
||||
)
|
||||
|
||||
@Deprecated("Creates unbound symbols")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>? = null,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierDescriptor: ClassDescriptor? = null
|
||||
) : this(
|
||||
startOffset, endOffset,
|
||||
type,
|
||||
createFunctionSymbol(descriptor),
|
||||
descriptor,
|
||||
descriptor.typeArgumentsCount,
|
||||
origin,
|
||||
createClassSymbolOrNull(superQualifierDescriptor)
|
||||
) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
|
||||
@Deprecated("Creates unbound symbols")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>? = null,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierDescriptor: ClassDescriptor? = null
|
||||
) : this(
|
||||
startOffset, endOffset,
|
||||
descriptor.returnType!!,
|
||||
createFunctionSymbol(descriptor),
|
||||
descriptor,
|
||||
descriptor.typeArgumentsCount,
|
||||
origin,
|
||||
createClassSymbolOrNull(superQualifierDescriptor)
|
||||
) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
symbol: IrFunctionSymbol,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>? = null,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : this(
|
||||
startOffset,
|
||||
endOffset,
|
||||
descriptor.returnType!!,
|
||||
symbol,
|
||||
descriptor,
|
||||
descriptor.typeArgumentsCount,
|
||||
origin,
|
||||
superQualifierSymbol
|
||||
) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, symbol: IrFunctionSymbol, origin: IrStatementOrigin? = null) :
|
||||
this(startOffset, endOffset, symbol, symbol.descriptor, origin = origin)
|
||||
constructor(startOffset: Int, endOffset: Int, type: IrType, symbol: IrFunctionSymbol) :
|
||||
this(startOffset, endOffset, type, symbol, symbol.descriptor)
|
||||
|
||||
|
||||
override val superQualifier: ClassDescriptor? = superQualifierSymbol?.descriptor
|
||||
|
||||
+2
-3
@@ -18,15 +18,14 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.util.render
|
||||
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.types.KotlinType
|
||||
|
||||
abstract class IrCallWithIndexedArgumentsBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
typeArgumentsCount: Int,
|
||||
valueArgumentsCount: Int,
|
||||
origin: IrStatementOrigin? = null
|
||||
|
||||
+9
-7
@@ -23,27 +23,29 @@ import org.jetbrains.kotlin.ir.expressions.IrClassReference
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrClassReferenceImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
symbol: IrClassifierSymbol,
|
||||
override val classType: KotlinType
|
||||
) : IrClassReference,
|
||||
override val classType: IrType
|
||||
) :
|
||||
IrTerminalDeclarationReferenceBase<IrClassifierSymbol, ClassifierDescriptor>(
|
||||
startOffset, endOffset, type,
|
||||
symbol, symbol.descriptor
|
||||
) {
|
||||
),
|
||||
IrClassReference {
|
||||
|
||||
@Deprecated("Creates unbound symbols")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
descriptor: ClassifierDescriptor,
|
||||
classType: KotlinType
|
||||
classType: IrType
|
||||
) : this(startOffset, endOffset, type, createClassifierSymbol(descriptor), classType)
|
||||
|
||||
override val descriptor: ClassifierDescriptor get() = symbol.descriptor
|
||||
|
||||
+17
-5
@@ -19,14 +19,26 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.expressions.IrComposite
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
|
||||
class IrCompositeImpl(startOffset: Int, endOffset: Int, type: KotlinType, origin: IrStatementOrigin? = null) :
|
||||
IrContainerExpressionBase(startOffset, endOffset, type, origin), IrComposite {
|
||||
constructor(startOffset: Int, endOffset: Int, type: KotlinType, origin: IrStatementOrigin?, statements: List<IrStatement>) :
|
||||
this(startOffset, endOffset, type, origin) {
|
||||
class IrCompositeImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null
|
||||
) :
|
||||
IrContainerExpressionBase(startOffset, endOffset, type, origin),
|
||||
IrComposite {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
statements: List<IrStatement>
|
||||
) : this(startOffset, endOffset, type, origin) {
|
||||
this.statements.addAll(statements)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConst
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrConstImpl<T>(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val kind: IrConstKind<T>,
|
||||
override val value: T
|
||||
) : IrTerminalExpressionBase(startOffset, endOffset, type), IrConst<T> {
|
||||
@@ -36,40 +36,40 @@ class IrConstImpl<T>(
|
||||
IrConstImpl(startOffset, endOffset, type, kind, value)
|
||||
|
||||
companion object {
|
||||
fun string(startOffset: Int, endOffset: Int, type: KotlinType, value: String): IrConstImpl<String> =
|
||||
fun string(startOffset: Int, endOffset: Int, type: IrType, value: String): IrConstImpl<String> =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.String, value)
|
||||
|
||||
fun int(startOffset: Int, endOffset: Int, type: KotlinType, value: Int): IrConstImpl<Int> =
|
||||
fun int(startOffset: Int, endOffset: Int, type: IrType, value: Int): IrConstImpl<Int> =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.Int, value)
|
||||
|
||||
fun constNull(startOffset: Int, endOffset: Int, type: KotlinType): IrConstImpl<Nothing?> =
|
||||
fun constNull(startOffset: Int, endOffset: Int, type: IrType): IrConstImpl<Nothing?> =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.Null, null)
|
||||
|
||||
fun boolean(startOffset: Int, endOffset: Int, type: KotlinType, value: Boolean): IrConstImpl<Boolean> =
|
||||
fun boolean(startOffset: Int, endOffset: Int, type: IrType, value: Boolean): IrConstImpl<Boolean> =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.Boolean, value)
|
||||
|
||||
fun constTrue(startOffset: Int, endOffset: Int, type: KotlinType): IrConstImpl<Boolean> =
|
||||
fun constTrue(startOffset: Int, endOffset: Int, type: IrType): IrConstImpl<Boolean> =
|
||||
boolean(startOffset, endOffset, type, true)
|
||||
|
||||
fun constFalse(startOffset: Int, endOffset: Int, type: KotlinType): IrConstImpl<Boolean> =
|
||||
fun constFalse(startOffset: Int, endOffset: Int, type: IrType): IrConstImpl<Boolean> =
|
||||
boolean(startOffset, endOffset, type, false)
|
||||
|
||||
fun long(startOffset: Int, endOffset: Int, type: KotlinType, value: Long): IrExpression =
|
||||
fun long(startOffset: Int, endOffset: Int, type: IrType, value: Long): IrExpression =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.Long, value)
|
||||
|
||||
fun float(startOffset: Int, endOffset: Int, type: KotlinType, value: Float): IrExpression =
|
||||
fun float(startOffset: Int, endOffset: Int, type: IrType, value: Float): IrExpression =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.Float, value)
|
||||
|
||||
fun double(startOffset: Int, endOffset: Int, type: KotlinType, value: Double): IrExpression =
|
||||
fun double(startOffset: Int, endOffset: Int, type: IrType, value: Double): IrExpression =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.Double, value)
|
||||
|
||||
fun char(startOffset: Int, endOffset: Int, type: KotlinType, value: Char): IrExpression =
|
||||
fun char(startOffset: Int, endOffset: Int, type: IrType, value: Char): IrExpression =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.Char, value)
|
||||
|
||||
fun byte(startOffset: Int, endOffset: Int, type: KotlinType, value: Byte): IrExpression =
|
||||
fun byte(startOffset: Int, endOffset: Int, type: IrType, value: Byte): IrExpression =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.Byte, value)
|
||||
|
||||
fun short(startOffset: Int, endOffset: Int, type: KotlinType, value: Short): IrExpression =
|
||||
fun short(startOffset: Int, endOffset: Int, type: IrType, value: Short): IrExpression =
|
||||
IrConstImpl(startOffset, endOffset, type, IrConstKind.Short, value)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -19,16 +19,16 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.expressions.IrContainerExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.util.transform
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import java.util.*
|
||||
|
||||
abstract class IrContainerExpressionBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val origin: IrStatementOrigin? = null
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type), IrContainerExpression {
|
||||
|
||||
@@ -18,13 +18,13 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrContinue
|
||||
import org.jetbrains.kotlin.ir.expressions.IrLoop
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrContinueImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
loop: IrLoop
|
||||
) : IrBreakContinueBase(startOffset, endOffset, type, loop), IrContinue {
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
|
||||
+4
-3
@@ -19,12 +19,13 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrDeclarationReference
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
|
||||
abstract class IrDeclarationReferenceBase<out S : IrSymbol, out D : DeclarationDescriptor>(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val symbol: S,
|
||||
override val descriptor: D
|
||||
) : IrExpressionBase(startOffset, endOffset, type), IrDeclarationReference
|
||||
) : IrExpressionBase(startOffset, endOffset, type),
|
||||
IrDeclarationReference
|
||||
+5
-31
@@ -17,19 +17,16 @@
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrDelegatingConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.copyTypeArgumentsFrom
|
||||
import org.jetbrains.kotlin.ir.expressions.typeArgumentsCount
|
||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrConstructorSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrDelegatingConstructorCallImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val symbol: IrConstructorSymbol,
|
||||
override val descriptor: ClassConstructorDescriptor,
|
||||
typeArgumentsCount: Int
|
||||
@@ -37,49 +34,26 @@ class IrDelegatingConstructorCallImpl(
|
||||
IrCallWithIndexedArgumentsBase(
|
||||
startOffset,
|
||||
endOffset,
|
||||
symbol.descriptor.builtIns.unitType,
|
||||
type,
|
||||
typeArgumentsCount = typeArgumentsCount,
|
||||
valueArgumentsCount = symbol.descriptor.valueParameters.size
|
||||
),
|
||||
IrDelegatingConstructorCall {
|
||||
|
||||
@Deprecated("Use constructor with typeArgumentsCount and fill type arguments explicitly or with copyTypeArgumentsFrom")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
symbol: IrConstructorSymbol,
|
||||
descriptor: ClassConstructorDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>? = null
|
||||
) : this(startOffset, endOffset, symbol, descriptor, descriptor.typeArgumentsCount) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
descriptor: ClassConstructorDescriptor,
|
||||
typeArgumentsCount: Int
|
||||
) : this(
|
||||
startOffset, endOffset,
|
||||
startOffset, endOffset, type,
|
||||
IrConstructorSymbolImpl(descriptor.original),
|
||||
descriptor,
|
||||
typeArgumentsCount
|
||||
)
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
descriptor: ClassConstructorDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>? = null
|
||||
) : this(
|
||||
startOffset, endOffset,
|
||||
IrConstructorSymbolImpl(descriptor.original),
|
||||
descriptor,
|
||||
typeArguments
|
||||
)
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
return visitor.visitDelegatingConstructorCall(this, data)
|
||||
}
|
||||
|
||||
+16
-5
@@ -19,15 +19,26 @@ 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
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrDoWhileLoopImpl(startOffset: Int, endOffset: Int, type: KotlinType, origin: IrStatementOrigin?) :
|
||||
IrLoopBase(startOffset, endOffset, type, origin), IrDoWhileLoop {
|
||||
class IrDoWhileLoopImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?
|
||||
) :
|
||||
IrLoopBase(startOffset, endOffset, type, origin),
|
||||
IrDoWhileLoop {
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, type: KotlinType, origin: IrStatementOrigin?,
|
||||
body: IrExpression, condition: IrExpression
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
body: IrExpression,
|
||||
condition: IrExpression
|
||||
) : this(startOffset, endOffset, type, origin) {
|
||||
this.condition = condition
|
||||
this.body = body
|
||||
|
||||
+5
-25
@@ -17,56 +17,36 @@
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrEnumConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.copyTypeArgumentsFrom
|
||||
import org.jetbrains.kotlin.ir.expressions.typeArgumentsCount
|
||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrConstructorSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrEnumConstructorCallImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val symbol: IrConstructorSymbol,
|
||||
typeArgumentsCount: Int
|
||||
) :
|
||||
IrCallWithIndexedArgumentsBase(
|
||||
startOffset,
|
||||
endOffset,
|
||||
symbol.descriptor.builtIns.unitType,
|
||||
type,
|
||||
typeArgumentsCount = typeArgumentsCount,
|
||||
valueArgumentsCount = symbol.descriptor.valueParameters.size
|
||||
),
|
||||
IrEnumConstructorCall {
|
||||
|
||||
@Deprecated("Use constructor with typeArgumentsCount and fill type arguments explicitly or with copyTypeArgumentsFrom")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
symbol: IrConstructorSymbol,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>? = null
|
||||
) : this(startOffset, endOffset, symbol, symbol.descriptor.typeArgumentsCount) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
|
||||
@Deprecated("Creates unbound symbols")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
descriptor: ClassConstructorDescriptor,
|
||||
typeArgumentsCount: Int
|
||||
) : this(startOffset, endOffset, IrConstructorSymbolImpl(descriptor), typeArgumentsCount)
|
||||
|
||||
@Deprecated("Creates unbound symbols")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
descriptor: ClassConstructorDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>? = null
|
||||
) : this(startOffset, endOffset, IrConstructorSymbolImpl(descriptor), typeArguments)
|
||||
) : this(startOffset, endOffset, type, IrConstructorSymbolImpl(descriptor), typeArgumentsCount)
|
||||
|
||||
override val descriptor: ClassConstructorDescriptor get() = symbol.descriptor
|
||||
|
||||
|
||||
+2
-2
@@ -18,15 +18,15 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrErrorCallExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
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.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
|
||||
class IrErrorCallExpressionImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val description: String
|
||||
) : IrExpressionBase(startOffset, endOffset, type), IrErrorCallExpression {
|
||||
override var explicitReceiver: IrExpression? = null
|
||||
|
||||
+2
-2
@@ -18,13 +18,13 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrErrorExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionWithCopy
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrErrorExpressionImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val description: String
|
||||
) : IrTerminalExpressionBase(startOffset, endOffset, type), IrExpressionWithCopy, IrErrorExpression {
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
|
||||
+2
-2
@@ -18,10 +18,10 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.IrElementBase
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
|
||||
abstract class IrExpressionBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
override val type: KotlinType
|
||||
override val type: IrType
|
||||
) : IrElementBase(startOffset, endOffset), IrExpression
|
||||
+1
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
|
||||
class IrExpressionBodyImpl(startOffset: Int, endOffset: Int) : IrElementBase(startOffset, endOffset), IrExpressionBody {
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, expression: IrExpression) : this(startOffset, endOffset) {
|
||||
this.expression = expression
|
||||
}
|
||||
|
||||
+7
-4
@@ -23,17 +23,20 @@ import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
|
||||
abstract class IrFieldExpressionBase(
|
||||
startOffset: Int, endOffset: Int,
|
||||
override val symbol: IrFieldSymbol,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val origin: IrStatementOrigin? = null,
|
||||
override val superQualifierSymbol: IrClassSymbol?
|
||||
) : IrExpressionBase(startOffset, endOffset, type), IrFieldAccessExpression {
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrFieldAccessExpression {
|
||||
|
||||
override val descriptor: PropertyDescriptor get() = symbol.descriptor
|
||||
override val superQualifier: ClassDescriptor? get() = superQualifierSymbol?.descriptor
|
||||
|
||||
override final var receiver: IrExpression? = null
|
||||
final override var receiver: IrExpression? = null
|
||||
}
|
||||
+3
-32
@@ -17,20 +17,17 @@
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrFunctionReference
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.expressions.copyTypeArgumentsFrom
|
||||
import org.jetbrains.kotlin.ir.expressions.typeArgumentsCount
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrFunctionReferenceImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val symbol: IrFunctionSymbol,
|
||||
override val descriptor: FunctionDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
@@ -46,42 +43,16 @@ class IrFunctionReferenceImpl(
|
||||
),
|
||||
IrFunctionReference {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
symbol: IrFunctionSymbol,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>? = null,
|
||||
origin: IrStatementOrigin? = null
|
||||
) : this(startOffset, endOffset, type, symbol, descriptor, descriptor.typeArgumentsCount, origin) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
origin: IrStatementOrigin? = null
|
||||
) : this(startOffset, endOffset, type, createFunctionSymbol(descriptor.original), descriptor, typeArgumentsCount, origin)
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>? = null,
|
||||
origin: IrStatementOrigin? = null
|
||||
) : this(
|
||||
startOffset, endOffset, type, createFunctionSymbol(descriptor.original), descriptor, descriptor.typeArgumentsCount, origin
|
||||
) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitFunctionReference(this, data)
|
||||
}
|
||||
@@ -18,12 +18,19 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrGetClass
|
||||
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.types.KotlinType
|
||||
|
||||
class IrGetClassImpl(startOffset: Int, endOffset: Int, type: KotlinType) : IrExpressionBase(startOffset, endOffset, type), IrGetClass {
|
||||
constructor(startOffset: Int, endOffset: Int, type: KotlinType, argument: IrExpression) : this(startOffset, endOffset, type) {
|
||||
class IrGetClassImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrGetClass {
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, type: IrType, argument: IrExpression) : this(startOffset, endOffset, type) {
|
||||
this.argument = argument
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -20,21 +20,23 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue
|
||||
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrEnumEntrySymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrGetEnumValueImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
symbol: IrEnumEntrySymbol
|
||||
) : IrGetEnumValue,
|
||||
IrTerminalDeclarationReferenceBase<IrEnumEntrySymbol, ClassDescriptor>(startOffset, endOffset, type, symbol, symbol.descriptor) {
|
||||
) :
|
||||
IrTerminalDeclarationReferenceBase<IrEnumEntrySymbol, ClassDescriptor>(startOffset, endOffset, type, symbol, symbol.descriptor),
|
||||
IrGetEnumValue {
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
descriptor: ClassDescriptor
|
||||
) : this(startOffset, endOffset, type, IrEnumEntrySymbolImpl(descriptor))
|
||||
|
||||
|
||||
+25
-12
@@ -25,51 +25,64 @@ import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrFieldSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createClassSymbolOrNull
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
|
||||
class IrGetFieldImpl(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
symbol: IrFieldSymbol,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : IrGetField,
|
||||
IrFieldExpressionBase(startOffset, endOffset, symbol, symbol.descriptor.type, origin, superQualifierSymbol) {
|
||||
) : IrFieldExpressionBase(startOffset, endOffset, symbol, type, origin, superQualifierSymbol),
|
||||
IrGetField {
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
propertyDescriptor: PropertyDescriptor,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifier: ClassDescriptor? = null
|
||||
) : this(
|
||||
startOffset, endOffset,
|
||||
IrFieldSymbolImpl(propertyDescriptor),
|
||||
type,
|
||||
origin,
|
||||
createClassSymbolOrNull(superQualifier)
|
||||
)
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
propertyDescriptor: PropertyDescriptor,
|
||||
receiver: IrExpression?,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifier: ClassDescriptor? = null
|
||||
) : this(
|
||||
startOffset, endOffset,
|
||||
IrFieldSymbolImpl(propertyDescriptor),
|
||||
receiver, origin,
|
||||
createClassSymbolOrNull(superQualifier)
|
||||
)
|
||||
) :
|
||||
this(
|
||||
startOffset, endOffset,
|
||||
IrFieldSymbolImpl(propertyDescriptor),
|
||||
receiver,
|
||||
type,
|
||||
origin,
|
||||
createClassSymbolOrNull(superQualifier)
|
||||
)
|
||||
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
symbol: IrFieldSymbol,
|
||||
receiver: IrExpression?,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : this(startOffset, endOffset, symbol, origin, superQualifierSymbol) {
|
||||
) : this(startOffset, endOffset, symbol, type, origin, superQualifierSymbol) {
|
||||
this.receiver = receiver
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -20,21 +20,23 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrGetObjectValue
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrGetObjectValueImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
symbol: IrClassSymbol
|
||||
) : IrGetObjectValue,
|
||||
IrTerminalDeclarationReferenceBase<IrClassSymbol, ClassDescriptor>(startOffset, endOffset, type, symbol, symbol.descriptor) {
|
||||
) :
|
||||
IrTerminalDeclarationReferenceBase<IrClassSymbol, ClassDescriptor>(startOffset, endOffset, type, symbol, symbol.descriptor),
|
||||
IrGetObjectValue {
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
descriptor: ClassDescriptor
|
||||
) : this(startOffset, endOffset, type, IrClassSymbolImpl(descriptor))
|
||||
|
||||
|
||||
@@ -21,30 +21,35 @@ import org.jetbrains.kotlin.ir.expressions.IrGetValue
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createValueSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
|
||||
class IrGetValueImpl(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
symbol: IrValueSymbol,
|
||||
override val origin: IrStatementOrigin? = null
|
||||
) : IrGetValue,
|
||||
IrTerminalDeclarationReferenceBase<IrValueSymbol, ValueDescriptor>(
|
||||
startOffset,
|
||||
endOffset,
|
||||
symbol.descriptor.type,
|
||||
type,
|
||||
symbol,
|
||||
symbol.descriptor
|
||||
) {
|
||||
@Deprecated("Creates unbound reference")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
descriptor: ValueDescriptor,
|
||||
origin: IrStatementOrigin? = null
|
||||
) : this(startOffset, endOffset, createValueSymbol(descriptor), origin)
|
||||
) : this(startOffset, endOffset, type, createValueSymbol(descriptor), origin)
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitGetValue(this, data)
|
||||
|
||||
override fun copy(): IrGetValue =
|
||||
IrGetValueImpl(startOffset, endOffset, symbol, origin)
|
||||
IrGetValueImpl(startOffset, endOffset, type, symbol, origin)
|
||||
}
|
||||
+7
-3
@@ -19,17 +19,21 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBranch
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
|
||||
class IrIfThenElseImpl(
|
||||
startOffset: Int, endOffset: Int, type: KotlinType,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val origin: IrStatementOrigin? = null
|
||||
) : IrWhenBase(startOffset, endOffset, type) {
|
||||
override val branches: MutableList<IrBranch> = SmartList()
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, type: KotlinType,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
condition: IrExpression,
|
||||
thenBranch: IrExpression,
|
||||
elseBranch: IrExpression? = null,
|
||||
|
||||
+8
-5
@@ -20,20 +20,23 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrInstanceInitializerCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
|
||||
class IrInstanceInitializerCallImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
override val classSymbol: IrClassSymbol
|
||||
) : IrTerminalExpressionBase(startOffset, endOffset, classSymbol.descriptor.builtIns.unitType), IrInstanceInitializerCall {
|
||||
override val classSymbol: IrClassSymbol,
|
||||
type: IrType
|
||||
) : IrTerminalExpressionBase(startOffset, endOffset, type), IrInstanceInitializerCall {
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
descriptor: ClassDescriptor
|
||||
) : this(startOffset, endOffset, IrClassSymbolImpl(descriptor))
|
||||
descriptor: ClassDescriptor,
|
||||
type: IrType
|
||||
) : this(startOffset, endOffset, IrClassSymbolImpl(descriptor), type)
|
||||
|
||||
override val classDescriptor: ClassDescriptor get() = classSymbol.descriptor
|
||||
|
||||
|
||||
+2
-2
@@ -21,13 +21,13 @@ import org.jetbrains.kotlin.ir.expressions.IrLocalDelegatedPropertyReference
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrLocalDelegatedPropertyReferenceImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val descriptor: VariableDescriptorWithAccessors,
|
||||
override val delegate: IrVariableSymbol,
|
||||
override val getter: IrFunctionSymbol,
|
||||
|
||||
@@ -19,14 +19,17 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrLoop
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
|
||||
abstract class IrLoopBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val origin: IrStatementOrigin?
|
||||
) : IrExpressionBase(startOffset, endOffset, type), IrLoop {
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrLoop {
|
||||
|
||||
override var label: String? = null
|
||||
|
||||
override lateinit var condition: IrExpression
|
||||
|
||||
+5
-5
@@ -19,14 +19,14 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
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.types.KotlinType
|
||||
|
||||
abstract class IrMemberAccessExpressionBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
final override val typeArgumentsCount: Int,
|
||||
final override val valueArgumentsCount: Int,
|
||||
final override val origin: IrStatementOrigin? = null
|
||||
@@ -36,16 +36,16 @@ abstract class IrMemberAccessExpressionBase(
|
||||
override var dispatchReceiver: IrExpression? = null
|
||||
override var extensionReceiver: IrExpression? = null
|
||||
|
||||
private val typeArgumentsByIndex = arrayOfNulls<KotlinType>(typeArgumentsCount)
|
||||
private val typeArgumentsByIndex = arrayOfNulls<IrType>(typeArgumentsCount)
|
||||
|
||||
override fun getTypeArgument(index: Int): KotlinType? {
|
||||
override fun getTypeArgument(index: Int): IrType? {
|
||||
if (index >= typeArgumentsCount) {
|
||||
throw AssertionError("$this: No such type argument slot: $index")
|
||||
}
|
||||
return typeArgumentsByIndex[index]
|
||||
}
|
||||
|
||||
override fun putTypeArgument(index: Int, type: KotlinType?) {
|
||||
override fun putTypeArgument(index: Int, type: IrType?) {
|
||||
if (index >= typeArgumentsCount) {
|
||||
throw AssertionError("$this: No such type argument slot: $index")
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,12 +19,12 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.ir.expressions.IrCallableReference
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
|
||||
abstract class IrNoArgumentsCallableReferenceBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
typeArgumentsCount: Int,
|
||||
origin: IrStatementOrigin? = null
|
||||
) : IrMemberAccessExpressionBase(startOffset, endOffset, type, typeArgumentsCount, 0, origin),
|
||||
|
||||
+55
-33
@@ -25,18 +25,20 @@ import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createFunctionSymbol
|
||||
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.types.KotlinType
|
||||
import java.lang.UnsupportedOperationException
|
||||
|
||||
abstract class IrPrimitiveCallBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val origin: IrStatementOrigin?,
|
||||
override val symbol: IrFunctionSymbol,
|
||||
override val valueArgumentsCount: Int
|
||||
) : IrExpressionBase(startOffset, endOffset, symbol.descriptor.returnType!!),
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrCall {
|
||||
|
||||
override val descriptor: FunctionDescriptor get() = symbol.descriptor
|
||||
@@ -45,10 +47,10 @@ abstract class IrPrimitiveCallBase(
|
||||
|
||||
override val typeArgumentsCount: Int = 0
|
||||
|
||||
override fun getTypeArgument(index: Int): KotlinType? =
|
||||
override fun getTypeArgument(index: Int): IrType? =
|
||||
throw AssertionError("Primitive $descriptor has no type arguments")
|
||||
|
||||
override fun putTypeArgument(index: Int, type: KotlinType?) {
|
||||
override fun putTypeArgument(index: Int, type: IrType?) {
|
||||
throw AssertionError("Primitive $descriptor has no type arguments")
|
||||
}
|
||||
|
||||
@@ -83,9 +85,10 @@ abstract class IrPrimitiveCallBase(
|
||||
class IrNullaryPrimitiveImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
symbol: IrFunctionSymbol
|
||||
) : IrPrimitiveCallBase(startOffset, endOffset, origin, symbol, 0),
|
||||
) : IrPrimitiveCallBase(startOffset, endOffset, type, origin, symbol, 0),
|
||||
IrCallWithShallowCopy {
|
||||
|
||||
override fun getValueArgument(index: Int): IrExpression? = null
|
||||
@@ -103,49 +106,56 @@ class IrNullaryPrimitiveImpl(
|
||||
}
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall =
|
||||
IrNullaryPrimitiveImpl(startOffset, endOffset, newOrigin, newCallee)
|
||||
IrNullaryPrimitiveImpl(startOffset, endOffset, type, newOrigin, newCallee)
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: FunctionDescriptor, newSuperQualifier: ClassDescriptor?): IrCall =
|
||||
IrNullaryPrimitiveImpl(startOffset, endOffset, newOrigin, createFunctionSymbol(newCallee))
|
||||
IrNullaryPrimitiveImpl(startOffset, endOffset, type, newOrigin, createFunctionSymbol(newCallee))
|
||||
}
|
||||
|
||||
class IrUnaryPrimitiveImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
symbol: IrFunctionSymbol
|
||||
) : IrPrimitiveCallBase(startOffset, endOffset, origin, symbol, 1),
|
||||
) : IrPrimitiveCallBase(startOffset, endOffset, type, origin, symbol, 1),
|
||||
IrCallWithShallowCopy {
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
functionDescriptor: FunctionDescriptor
|
||||
) : this(
|
||||
startOffset, endOffset, origin,
|
||||
startOffset, endOffset, type, origin,
|
||||
createFunctionSymbol(functionDescriptor)
|
||||
)
|
||||
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
functionDescriptor: FunctionDescriptor,
|
||||
argument: IrExpression
|
||||
) : this(
|
||||
startOffset, endOffset, origin,
|
||||
startOffset, endOffset, type, origin,
|
||||
createFunctionSymbol(functionDescriptor),
|
||||
argument
|
||||
)
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
symbol: IrFunctionSymbol,
|
||||
argument: IrExpression
|
||||
) : this(startOffset, endOffset, origin, symbol) {
|
||||
) : this(startOffset, endOffset, type, origin, symbol) {
|
||||
this.argument = argument
|
||||
}
|
||||
|
||||
@@ -174,49 +184,61 @@ class IrUnaryPrimitiveImpl(
|
||||
}
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall =
|
||||
IrUnaryPrimitiveImpl(startOffset, endOffset, newOrigin, newCallee)
|
||||
IrUnaryPrimitiveImpl(startOffset, endOffset, type, newOrigin, newCallee)
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: FunctionDescriptor, newSuperQualifier: ClassDescriptor?): IrCall =
|
||||
IrUnaryPrimitiveImpl(startOffset, endOffset, newOrigin, newCallee)
|
||||
IrUnaryPrimitiveImpl(startOffset, endOffset, type, newOrigin, newCallee)
|
||||
}
|
||||
|
||||
class IrBinaryPrimitiveImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
symbol: IrFunctionSymbol
|
||||
) : IrPrimitiveCallBase(startOffset, endOffset, origin, symbol, 2),
|
||||
) : IrPrimitiveCallBase(startOffset, endOffset, type, origin, symbol, 2),
|
||||
IrCallWithShallowCopy {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
symbol: IrFunctionSymbol,
|
||||
argument0: IrExpression,
|
||||
argument1: IrExpression
|
||||
) : this(startOffset, endOffset, type, origin, symbol) {
|
||||
this.argument0 = argument0
|
||||
this.argument1 = argument1
|
||||
}
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, origin: IrStatementOrigin?,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
descriptor: FunctionDescriptor
|
||||
) : this(
|
||||
startOffset, endOffset, origin,
|
||||
startOffset, endOffset, type, origin,
|
||||
createFunctionSymbol(descriptor)
|
||||
)
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, origin: IrStatementOrigin?,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
descriptor: FunctionDescriptor,
|
||||
argument0: IrExpression, argument1: IrExpression
|
||||
argument0: IrExpression,
|
||||
argument1: IrExpression
|
||||
) : this(
|
||||
startOffset, endOffset, origin,
|
||||
startOffset, endOffset, type, origin,
|
||||
createFunctionSymbol(descriptor),
|
||||
argument0, argument1
|
||||
)
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, origin: IrStatementOrigin?,
|
||||
symbol: IrFunctionSymbol,
|
||||
argument0: IrExpression, argument1: IrExpression
|
||||
) : this(startOffset, endOffset, origin, symbol) {
|
||||
this.argument0 = argument0
|
||||
this.argument1 = argument1
|
||||
}
|
||||
|
||||
lateinit var argument0: IrExpression
|
||||
lateinit var argument1: IrExpression
|
||||
|
||||
@@ -248,8 +270,8 @@ class IrBinaryPrimitiveImpl(
|
||||
}
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall =
|
||||
IrBinaryPrimitiveImpl(startOffset, endOffset, newOrigin, newCallee)
|
||||
IrBinaryPrimitiveImpl(startOffset, endOffset, type, newOrigin, newCallee)
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: FunctionDescriptor, newSuperQualifier: ClassDescriptor?): IrCall =
|
||||
IrBinaryPrimitiveImpl(startOffset, endOffset, newOrigin, newCallee)
|
||||
IrBinaryPrimitiveImpl(startOffset, endOffset, type, newOrigin, newCallee)
|
||||
}
|
||||
|
||||
+19
-47
@@ -18,27 +18,27 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createClassSymbolOrNull
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createFunctionSymbol
|
||||
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.types.KotlinType
|
||||
import java.lang.AssertionError
|
||||
import java.lang.UnsupportedOperationException
|
||||
|
||||
abstract class IrPropertyAccessorCallBase(
|
||||
startOffset: Int, endOffset: Int,
|
||||
type: IrType,
|
||||
override val symbol: IrFunctionSymbol,
|
||||
override val descriptor: FunctionDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
valueArgumentsCount: Int,
|
||||
origin: IrStatementOrigin? = null,
|
||||
override val superQualifierSymbol: IrClassSymbol? = null
|
||||
) : IrMemberAccessExpressionBase(startOffset, endOffset, descriptor.returnType!!, typeArgumentsCount, valueArgumentsCount, origin),
|
||||
) : IrMemberAccessExpressionBase(startOffset, endOffset, type, typeArgumentsCount, valueArgumentsCount, origin),
|
||||
IrCall {
|
||||
|
||||
override val superQualifier: ClassDescriptor? get() = superQualifierSymbol?.descriptor
|
||||
@@ -55,17 +55,20 @@ abstract class IrPropertyAccessorCallBase(
|
||||
class IrGetterCallImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
symbol: IrFunctionSymbol,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : IrPropertyAccessorCallBase(startOffset, endOffset, symbol, descriptor, typeArgumentsCount, 0, origin, superQualifierSymbol),
|
||||
) :
|
||||
IrPropertyAccessorCallBase(startOffset, endOffset, type, symbol, descriptor, typeArgumentsCount, 0, origin, superQualifierSymbol),
|
||||
IrCallWithShallowCopy {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
symbol: IrFunctionSymbol,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
@@ -73,29 +76,11 @@ class IrGetterCallImpl(
|
||||
extensionReceiver: IrExpression?,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : this(startOffset, endOffset, symbol, descriptor, typeArgumentsCount, origin, superQualifierSymbol) {
|
||||
) : this(startOffset, endOffset, type, symbol, descriptor, typeArgumentsCount, origin, superQualifierSymbol) {
|
||||
this.dispatchReceiver = dispatchReceiver
|
||||
this.extensionReceiver = extensionReceiver
|
||||
}
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
symbol: IrFunctionSymbol,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>?,
|
||||
dispatchReceiver: IrExpression?,
|
||||
extensionReceiver: IrExpression?,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : this(
|
||||
startOffset, endOffset, symbol, descriptor,
|
||||
descriptor.typeArgumentsCount,
|
||||
dispatchReceiver, extensionReceiver, origin, superQualifierSymbol
|
||||
) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
|
||||
override fun getValueArgument(index: Int): IrExpression? = null
|
||||
|
||||
override fun putValueArgument(index: Int, valueArgument: IrExpression?) {
|
||||
@@ -108,7 +93,7 @@ class IrGetterCallImpl(
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall =
|
||||
IrGetterCallImpl(
|
||||
startOffset, endOffset, newCallee,
|
||||
startOffset, endOffset, type, newCallee,
|
||||
descriptor, // TODO substitute descriptor for new callee?
|
||||
typeArgumentsCount, dispatchReceiver, extensionReceiver, newOrigin, newSuperQualifier
|
||||
).also { newCall ->
|
||||
@@ -117,7 +102,7 @@ class IrGetterCallImpl(
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: FunctionDescriptor, newSuperQualifier: ClassDescriptor?): IrCall =
|
||||
IrGetterCallImpl(
|
||||
startOffset, endOffset,
|
||||
startOffset, endOffset, type,
|
||||
createFunctionSymbol(newCallee),
|
||||
newCallee,
|
||||
typeArgumentsCount,
|
||||
@@ -132,16 +117,20 @@ class IrGetterCallImpl(
|
||||
|
||||
class IrSetterCallImpl(
|
||||
startOffset: Int, endOffset: Int,
|
||||
type: IrType,
|
||||
symbol: IrFunctionSymbol,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : IrPropertyAccessorCallBase(startOffset, endOffset, symbol, descriptor, typeArgumentsCount, 1, origin, superQualifierSymbol),
|
||||
) :
|
||||
IrPropertyAccessorCallBase(startOffset, endOffset, type, symbol, descriptor, typeArgumentsCount, 1, origin, superQualifierSymbol),
|
||||
IrCallWithShallowCopy {
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
symbol: IrFunctionSymbol,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
@@ -150,24 +139,7 @@ class IrSetterCallImpl(
|
||||
argument: IrExpression,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : this(startOffset, endOffset, symbol, descriptor, typeArgumentsCount, origin, superQualifierSymbol) {
|
||||
this.dispatchReceiver = dispatchReceiver
|
||||
this.extensionReceiver = extensionReceiver
|
||||
putValueArgument(SETTER_ARGUMENT_INDEX, argument)
|
||||
}
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
symbol: IrFunctionSymbol,
|
||||
descriptor: FunctionDescriptor,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>?,
|
||||
dispatchReceiver: IrExpression?,
|
||||
extensionReceiver: IrExpression?,
|
||||
argument: IrExpression,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : this(startOffset, endOffset, symbol, descriptor, descriptor.typeArgumentsCount, origin, superQualifierSymbol) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
) : this(startOffset, endOffset, type, symbol, descriptor, typeArgumentsCount, origin, superQualifierSymbol) {
|
||||
this.dispatchReceiver = dispatchReceiver
|
||||
this.extensionReceiver = extensionReceiver
|
||||
putValueArgument(SETTER_ARGUMENT_INDEX, argument)
|
||||
@@ -190,7 +162,7 @@ class IrSetterCallImpl(
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: IrFunctionSymbol, newSuperQualifier: IrClassSymbol?): IrCall =
|
||||
IrSetterCallImpl(
|
||||
startOffset, endOffset, newCallee,
|
||||
startOffset, endOffset, type, newCallee,
|
||||
descriptor, // TODO substitute newCallee.descriptor?
|
||||
typeArgumentsCount, dispatchReceiver, extensionReceiver, argumentImpl!!, newOrigin, newSuperQualifier
|
||||
).also { newCall ->
|
||||
@@ -199,7 +171,7 @@ class IrSetterCallImpl(
|
||||
|
||||
override fun shallowCopy(newOrigin: IrStatementOrigin?, newCallee: FunctionDescriptor, newSuperQualifier: ClassDescriptor?): IrCall =
|
||||
IrSetterCallImpl(
|
||||
startOffset, endOffset,
|
||||
startOffset, endOffset, type,
|
||||
createFunctionSymbol(newCallee),
|
||||
newCallee,
|
||||
typeArgumentsCount,
|
||||
|
||||
+2
-19
@@ -17,20 +17,17 @@
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrPropertyReference
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.expressions.copyTypeArgumentsFrom
|
||||
import org.jetbrains.kotlin.ir.expressions.typeArgumentsCount
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrPropertyReferenceImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val descriptor: PropertyDescriptor,
|
||||
typeArgumentsCount: Int,
|
||||
override val field: IrFieldSymbol?,
|
||||
@@ -40,20 +37,6 @@ class IrPropertyReferenceImpl(
|
||||
) : IrNoArgumentsCallableReferenceBase(startOffset, endOffset, type, typeArgumentsCount, origin),
|
||||
IrPropertyReference {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
descriptor: PropertyDescriptor,
|
||||
field: IrFieldSymbol?,
|
||||
getter: IrFunctionSymbol?,
|
||||
setter: IrFunctionSymbol?,
|
||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>?,
|
||||
origin: IrStatementOrigin? = null
|
||||
) : this(startOffset, endOffset, type, descriptor, descriptor.typeArgumentsCount, field, getter, setter, origin) {
|
||||
copyTypeArgumentsFrom(typeArguments)
|
||||
}
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitPropertyReference(this, data)
|
||||
}
|
||||
@@ -19,39 +19,25 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrReturn
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrReturnTargetSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createFunctionSymbol
|
||||
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.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class IrReturnImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val returnTargetSymbol: IrReturnTargetSymbol,
|
||||
override var value: IrExpression
|
||||
) : IrExpressionBase(startOffset, endOffset, type), IrReturn {
|
||||
constructor(startOffset: Int, endOffset: Int, returnTargetSymbol: IrFunctionSymbol, value: IrExpression) :
|
||||
this(startOffset, endOffset, returnTargetSymbol.descriptor.builtIns.nothingType, returnTargetSymbol, value)
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrReturn {
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(startOffset: Int, endOffset: Int, type: KotlinType, returnTargetDescriptor: FunctionDescriptor, value: IrExpression) :
|
||||
this(
|
||||
startOffset, endOffset, type,
|
||||
createFunctionSymbol(returnTargetDescriptor),
|
||||
value
|
||||
)
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(startOffset: Int, endOffset: Int, returnTargetDescriptor: FunctionDescriptor, value: IrExpression) :
|
||||
this(
|
||||
startOffset, endOffset, returnTargetDescriptor.builtIns.nothingType,
|
||||
createFunctionSymbol(returnTargetDescriptor),
|
||||
value
|
||||
)
|
||||
constructor(startOffset: Int, endOffset: Int, type: IrType, returnTargetDescriptor: FunctionDescriptor, value: IrExpression) :
|
||||
this(startOffset, endOffset, type, createFunctionSymbol(returnTargetDescriptor), value)
|
||||
|
||||
override val returnTarget: FunctionDescriptor get() = returnTargetSymbol.descriptor
|
||||
|
||||
|
||||
@@ -25,48 +25,60 @@ import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrFieldSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.createClassSymbolOrNull
|
||||
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.types.typeUtil.builtIns
|
||||
|
||||
class IrSetFieldImpl(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
symbol: IrFieldSymbol,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : IrSetField,
|
||||
) :
|
||||
IrFieldExpressionBase(
|
||||
startOffset, endOffset,
|
||||
symbol,
|
||||
symbol.descriptor.type.builtIns.unitType,
|
||||
type,
|
||||
origin,
|
||||
superQualifierSymbol
|
||||
) {
|
||||
),
|
||||
IrSetField {
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
propertyDescriptor: PropertyDescriptor,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifier: ClassDescriptor? = null
|
||||
) : this(
|
||||
startOffset, endOffset,
|
||||
IrFieldSymbolImpl(propertyDescriptor),
|
||||
type,
|
||||
origin,
|
||||
createClassSymbolOrNull(superQualifier)
|
||||
)
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
propertyDescriptor: PropertyDescriptor,
|
||||
receiver: IrExpression?,
|
||||
value: IrExpression,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifier: ClassDescriptor? = null
|
||||
) : this(
|
||||
startOffset, endOffset,
|
||||
IrFieldSymbolImpl(propertyDescriptor),
|
||||
receiver, value, origin,
|
||||
receiver,
|
||||
value,
|
||||
type,
|
||||
origin,
|
||||
createClassSymbolOrNull(superQualifier)
|
||||
)
|
||||
|
||||
@@ -75,9 +87,10 @@ class IrSetFieldImpl(
|
||||
symbol: IrFieldSymbol,
|
||||
receiver: IrExpression?,
|
||||
value: IrExpression,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin? = null,
|
||||
superQualifierSymbol: IrClassSymbol? = null
|
||||
) : this(startOffset, endOffset, symbol, origin, superQualifierSymbol) {
|
||||
) : this(startOffset, endOffset, symbol, type, origin, superQualifierSymbol) {
|
||||
this.receiver = receiver
|
||||
this.value = value
|
||||
}
|
||||
|
||||
+16
-7
@@ -22,31 +22,40 @@ import org.jetbrains.kotlin.ir.expressions.IrSetVariable
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrVariableSymbolImpl
|
||||
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.resolve.descriptorUtil.builtIns
|
||||
|
||||
class IrSetVariableImpl(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val symbol: IrVariableSymbol,
|
||||
override val origin: IrStatementOrigin?
|
||||
) : IrExpressionBase(startOffset, endOffset, symbol.descriptor.builtIns.unitType), IrSetVariable {
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrSetVariable {
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
symbol: IrVariableSymbol,
|
||||
value: IrExpression,
|
||||
origin: IrStatementOrigin?
|
||||
) : this(startOffset, endOffset, symbol, origin) {
|
||||
) : this(startOffset, endOffset, type, symbol, origin) {
|
||||
this.value = value
|
||||
}
|
||||
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
descriptor: VariableDescriptor,
|
||||
value: IrExpression,
|
||||
origin: IrStatementOrigin?
|
||||
) : this(startOffset, endOffset, IrVariableSymbolImpl(descriptor), value, origin)
|
||||
) : this(startOffset, endOffset, type, IrVariableSymbolImpl(descriptor), value, origin)
|
||||
|
||||
override val descriptor: VariableDescriptor get() = symbol.descriptor
|
||||
|
||||
|
||||
+1
@@ -26,6 +26,7 @@ class IrSpreadElementImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int
|
||||
) : IrElementBase(startOffset, endOffset), IrSpreadElement {
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, expression: IrExpression) : this(startOffset, endOffset) {
|
||||
this.expression = expression
|
||||
}
|
||||
|
||||
+15
-8
@@ -18,18 +18,25 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStringConcatenation
|
||||
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.types.KotlinType
|
||||
import java.util.*
|
||||
|
||||
class IrStringConcatenationImpl(startOffset: Int, endOffset: Int, type: KotlinType) :
|
||||
IrExpressionBase(startOffset, endOffset, type), IrStringConcatenation {
|
||||
constructor(startOffset: Int, endOffset: Int, type: KotlinType, arguments: Collection<IrExpression>) : this(
|
||||
startOffset,
|
||||
endOffset,
|
||||
type
|
||||
) {
|
||||
class IrStringConcatenationImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrStringConcatenation {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
arguments: Collection<IrExpression>
|
||||
) : this(startOffset, endOffset, type) {
|
||||
this.arguments.addAll(arguments)
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -22,7 +22,12 @@ import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
|
||||
class IrSyntheticBodyImpl(startOffset: Int, endOffset: Int, override val kind: IrSyntheticBodyKind) : IrElementBase(startOffset, endOffset),
|
||||
class IrSyntheticBodyImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
override val kind: IrSyntheticBodyKind
|
||||
) :
|
||||
IrElementBase(startOffset, endOffset),
|
||||
IrSyntheticBody {
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
return visitor.visitSyntheticBody(this, data)
|
||||
|
||||
+5
-3
@@ -19,17 +19,19 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrDeclarationReference
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
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.types.KotlinType
|
||||
|
||||
abstract class IrTerminalDeclarationReferenceBase<out S : IrSymbol, out D : DeclarationDescriptor>(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
symbol: S,
|
||||
descriptor: D
|
||||
) : IrDeclarationReferenceBase<S, D>(startOffset, endOffset, type, symbol, descriptor), IrDeclarationReference {
|
||||
) : IrDeclarationReferenceBase<S, D>(startOffset, endOffset, type, symbol, descriptor),
|
||||
IrDeclarationReference {
|
||||
|
||||
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
|
||||
// No children
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,14 +16,14 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
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.types.KotlinType
|
||||
|
||||
abstract class IrTerminalExpressionBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType
|
||||
type: IrType
|
||||
) : IrExpressionBase(startOffset, endOffset, type) {
|
||||
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
|
||||
// No children
|
||||
|
||||
@@ -18,19 +18,19 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrThrow
|
||||
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.types.KotlinType
|
||||
|
||||
class IrThrowImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType
|
||||
type: IrType
|
||||
) : IrExpressionBase(startOffset, endOffset, type), IrThrow {
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
value: IrExpression
|
||||
) : this(startOffset, endOffset, type) {
|
||||
this.value = value
|
||||
|
||||
@@ -22,16 +22,26 @@ import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.expressions.IrCatch
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrTry
|
||||
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.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
|
||||
class IrTryImpl(startOffset: Int, endOffset: Int, type: KotlinType) :
|
||||
IrExpressionBase(startOffset, endOffset, type), IrTry {
|
||||
class IrTryImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrTry {
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, type: KotlinType,
|
||||
tryResult: IrExpression, catches: List<IrCatch>, finallyExpression: IrExpression?
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
tryResult: IrExpression,
|
||||
catches: List<IrCatch>,
|
||||
finallyExpression: IrExpression?
|
||||
) : this(startOffset, endOffset, type) {
|
||||
this.tryResult = tryResult
|
||||
this.catches.addAll(catches)
|
||||
@@ -63,14 +73,27 @@ class IrTryImpl(startOffset: Int, endOffset: Int, type: KotlinType) :
|
||||
}
|
||||
}
|
||||
|
||||
class IrCatchImpl(startOffset: Int, endOffset: Int) : IrCatch, IrElementBase(startOffset, endOffset) {
|
||||
constructor(startOffset: Int, endOffset: Int, catchParameter: IrVariable)
|
||||
: this(startOffset, endOffset) {
|
||||
class IrCatchImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int
|
||||
) :
|
||||
IrElementBase(startOffset, endOffset),
|
||||
IrCatch {
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
catchParameter: IrVariable
|
||||
) : this(startOffset, endOffset) {
|
||||
this.catchParameter = catchParameter
|
||||
}
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, catchParameter: IrVariable, result: IrExpression)
|
||||
: this(startOffset, endOffset, catchParameter) {
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
catchParameter: IrVariable,
|
||||
result: IrExpression
|
||||
) : this(startOffset, endOffset, catchParameter) {
|
||||
this.result = result
|
||||
}
|
||||
|
||||
|
||||
+10
-24
@@ -20,40 +20,29 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrTypeOperator
|
||||
import org.jetbrains.kotlin.ir.expressions.IrTypeOperatorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
||||
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.types.KotlinType
|
||||
|
||||
class IrTypeOperatorCallImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val operator: IrTypeOperator,
|
||||
override val typeOperand: KotlinType
|
||||
) : IrExpressionBase(startOffset, endOffset, type), IrTypeOperatorCall {
|
||||
@Deprecated("Creates unbound symbol")
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
operator: IrTypeOperator,
|
||||
typeOperand: KotlinType,
|
||||
argument: IrExpression
|
||||
) : this(startOffset, endOffset, type, operator, typeOperand) {
|
||||
this.argument = argument
|
||||
override val typeOperand: IrType
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrTypeOperatorCall {
|
||||
|
||||
val typeOperandDescriptor = typeOperand.constructor.declarationDescriptor
|
||||
if (typeOperandDescriptor != null) {
|
||||
this.typeOperandClassifier = createClassifierSymbol(typeOperandDescriptor)
|
||||
}
|
||||
}
|
||||
override lateinit var argument: IrExpression
|
||||
override lateinit var typeOperandClassifier: IrClassifierSymbol
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
operator: IrTypeOperator,
|
||||
typeOperand: KotlinType,
|
||||
typeOperand: IrType,
|
||||
argument: IrExpression,
|
||||
typeOperandClassifier: IrClassifierSymbol
|
||||
) : this(startOffset, endOffset, type, operator, typeOperand) {
|
||||
@@ -61,9 +50,6 @@ class IrTypeOperatorCallImpl(
|
||||
this.typeOperandClassifier = typeOperandClassifier
|
||||
}
|
||||
|
||||
override lateinit var argument: IrExpression
|
||||
override lateinit var typeOperandClassifier: IrClassifierSymbol
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitTypeOperator(this, data)
|
||||
|
||||
|
||||
@@ -18,19 +18,25 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrVararg
|
||||
import org.jetbrains.kotlin.ir.expressions.IrVarargElement
|
||||
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.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
|
||||
class IrVarargImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
override val varargElementType: KotlinType
|
||||
) : IrVararg, IrExpressionBase(startOffset, endOffset, type) {
|
||||
type: IrType,
|
||||
override val varargElementType: IrType
|
||||
) :
|
||||
IrExpressionBase(startOffset, endOffset, type),
|
||||
IrVararg {
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, type: KotlinType, varargElementType: KotlinType,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
varargElementType: IrType,
|
||||
elements: List<IrVarargElement>
|
||||
) : this(startOffset, endOffset, type, varargElementType) {
|
||||
this.elements.addAll(elements)
|
||||
|
||||
@@ -18,14 +18,19 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.IrElementBase
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
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.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.typeUtil.builtIns
|
||||
import java.util.*
|
||||
|
||||
abstract class IrWhenBase(startOffset: Int, endOffset: Int, type: KotlinType, override val origin: IrStatementOrigin? = null) :
|
||||
IrExpressionBase(startOffset, endOffset, type), IrWhen {
|
||||
abstract class IrWhenBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
override val origin: IrStatementOrigin? = null
|
||||
) : IrExpressionBase(startOffset, endOffset, type),
|
||||
IrWhen {
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitWhen(this, data)
|
||||
|
||||
@@ -43,11 +48,15 @@ abstract class IrWhenBase(startOffset: Int, endOffset: Int, type: KotlinType, ov
|
||||
class IrWhenImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: KotlinType,
|
||||
type: IrType,
|
||||
override val origin: IrStatementOrigin? = null
|
||||
) : IrWhenBase(startOffset, endOffset, type) {
|
||||
|
||||
constructor(
|
||||
startOffset: Int, endOffset: Int, type: KotlinType, origin: IrStatementOrigin?,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?,
|
||||
branches: List<IrBranch>
|
||||
) : this(startOffset, endOffset, type, origin) {
|
||||
this.branches.addAll(branches)
|
||||
@@ -56,9 +65,15 @@ class IrWhenImpl(
|
||||
override val branches: MutableList<IrBranch> = ArrayList()
|
||||
}
|
||||
|
||||
open class IrBranchImpl(startOffset: Int, endOffset: Int, override var condition: IrExpression, override var result: IrExpression) :
|
||||
IrElementBase(startOffset, endOffset), IrBranch {
|
||||
constructor(condition: IrExpression, result: IrExpression) : this(condition.startOffset, condition.endOffset, condition, result)
|
||||
open class IrBranchImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
override var condition: IrExpression,
|
||||
override var result: IrExpression
|
||||
) : IrElementBase(startOffset, endOffset), IrBranch {
|
||||
|
||||
constructor(condition: IrExpression, result: IrExpression) :
|
||||
this(condition.startOffset, condition.endOffset, condition, result)
|
||||
|
||||
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
|
||||
condition.accept(visitor, data)
|
||||
@@ -70,16 +85,16 @@ open class IrBranchImpl(startOffset: Int, endOffset: Int, override var condition
|
||||
result = result.transform(transformer, data)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun elseBranch(result: IrExpression) =
|
||||
IrElseBranchImpl(
|
||||
IrConstImpl.boolean(result.startOffset, result.endOffset, result.type.builtIns.booleanType, true),
|
||||
result
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class IrElseBranchImpl(startOffset: Int, endOffset: Int, condition: IrExpression, result: IrExpression) :
|
||||
IrBranchImpl(startOffset, endOffset, condition, result), IrElseBranch {
|
||||
class IrElseBranchImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
condition: IrExpression,
|
||||
result: IrExpression
|
||||
) :
|
||||
IrBranchImpl(startOffset, endOffset, condition, result),
|
||||
IrElseBranch {
|
||||
|
||||
constructor(condition: IrExpression, result: IrExpression) : this(condition.startOffset, condition.endOffset, condition, result)
|
||||
}
|
||||
+10
-3
@@ -18,12 +18,19 @@ package org.jetbrains.kotlin.ir.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.expressions.IrWhileLoop
|
||||
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.types.KotlinType
|
||||
|
||||
class IrWhileLoopImpl(startOffset: Int, endOffset: Int, type: KotlinType, origin: IrStatementOrigin?) :
|
||||
IrLoopBase(startOffset, endOffset, type, origin), IrWhileLoop {
|
||||
class IrWhileLoopImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
type: IrType,
|
||||
origin: IrStatementOrigin?
|
||||
) :
|
||||
IrLoopBase(startOffset, endOffset, type, origin),
|
||||
IrWhileLoop {
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
return visitor.visitWhileLoop(this, data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user