IR: minor, don't store unnecessary fields
This commit is contained in:
+4
-1
@@ -12,10 +12,13 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
|
||||
abstract class IrFunctionAccessExpression(
|
||||
typeArgumentsCount: Int,
|
||||
final override val valueArgumentsCount: Int,
|
||||
valueArgumentsCount: Int,
|
||||
) : IrMemberAccessExpression<IrFunctionSymbol>(typeArgumentsCount) {
|
||||
private val argumentsByParameterIndex: Array<IrExpression?> = arrayOfNulls(valueArgumentsCount)
|
||||
|
||||
final override val valueArgumentsCount: Int
|
||||
get() = argumentsByParameterIndex.size
|
||||
|
||||
override fun getValueArgument(index: Int): IrExpression? {
|
||||
if (index >= valueArgumentsCount) {
|
||||
throw AssertionError("$this: No such value argument slot: $index")
|
||||
|
||||
+3
-3
@@ -20,9 +20,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
abstract class IrMemberAccessExpression<S : IrSymbol>(
|
||||
val typeArgumentsCount: Int
|
||||
) : IrDeclarationReference() {
|
||||
abstract class IrMemberAccessExpression<S : IrSymbol>(typeArgumentsCount: Int) : IrDeclarationReference() {
|
||||
var dispatchReceiver: IrExpression? = null
|
||||
var extensionReceiver: IrExpression? = null
|
||||
|
||||
@@ -37,6 +35,8 @@ abstract class IrMemberAccessExpression<S : IrSymbol>(
|
||||
|
||||
private val typeArgumentsByIndex = arrayOfNulls<IrType>(typeArgumentsCount)
|
||||
|
||||
val typeArgumentsCount: Int get() = typeArgumentsByIndex.size
|
||||
|
||||
fun getTypeArgument(index: Int): IrType? {
|
||||
if (index >= typeArgumentsCount) {
|
||||
throw AssertionError("$this: No such type argument slot: $index")
|
||||
|
||||
@@ -17,9 +17,11 @@ class IrSimpleTypeImpl(
|
||||
override val classifier: IrClassifierSymbol,
|
||||
override val hasQuestionMark: Boolean,
|
||||
override val arguments: List<IrTypeArgument>,
|
||||
annotations: List<IrConstructorCall>,
|
||||
override val annotations: List<IrConstructorCall>,
|
||||
override val abbreviation: IrTypeAbbreviation? = null
|
||||
) : IrTypeBase(kotlinType, annotations, Variance.INVARIANT), IrSimpleType, IrTypeProjection {
|
||||
) : IrTypeBase(kotlinType), IrSimpleType {
|
||||
override val variance: Variance
|
||||
get() = Variance.INVARIANT
|
||||
|
||||
constructor(
|
||||
classifier: IrClassifierSymbol,
|
||||
|
||||
@@ -11,32 +11,28 @@ import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
abstract class IrTypeBase(
|
||||
val kotlinType: KotlinType?,
|
||||
override val annotations: List<IrConstructorCall>,
|
||||
override val variance: Variance
|
||||
) : IrType, IrTypeProjection {
|
||||
abstract class IrTypeBase(val kotlinType: KotlinType?) : IrType, IrTypeProjection {
|
||||
override val type: IrType get() = this
|
||||
}
|
||||
|
||||
class IrErrorTypeImpl(
|
||||
kotlinType: KotlinType?,
|
||||
annotations: List<IrConstructorCall>,
|
||||
variance: Variance
|
||||
) : IrTypeBase(kotlinType, annotations, variance), IrErrorType {
|
||||
override val annotations: List<IrConstructorCall>,
|
||||
override val variance: Variance,
|
||||
) : IrTypeBase(kotlinType), IrErrorType {
|
||||
override fun equals(other: Any?): Boolean = other is IrErrorTypeImpl
|
||||
|
||||
override fun hashCode(): Int = IrErrorTypeImpl::class.java.name.hashCode()
|
||||
override fun hashCode(): Int = IrErrorTypeImpl::class.java.hashCode()
|
||||
}
|
||||
|
||||
class IrDynamicTypeImpl(
|
||||
kotlinType: KotlinType?,
|
||||
annotations: List<IrConstructorCall>,
|
||||
variance: Variance
|
||||
) : IrTypeBase(kotlinType, annotations, variance), IrDynamicType, IrTypeProjection {
|
||||
override val annotations: List<IrConstructorCall>,
|
||||
override val variance: Variance,
|
||||
) : IrTypeBase(kotlinType), IrDynamicType {
|
||||
override fun equals(other: Any?): Boolean = other is IrDynamicTypeImpl
|
||||
|
||||
override fun hashCode(): Int = IrDynamicTypeImpl::class.java.name.hashCode()
|
||||
override fun hashCode(): Int = IrDynamicTypeImpl::class.java.hashCode()
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user