[K/N] Get rid of ArrayAsList class, use .asList() instead
^KT-57137
This commit is contained in:
committed by
Space Team
parent
967ddb8bb0
commit
8f4c6eae2f
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.native.internal
|
||||
|
||||
class ArrayAsList<T>(val array: Array<T>) : AbstractList<T>(), RandomAccess {
|
||||
override val size: Int get() = array.size
|
||||
override fun isEmpty(): Boolean = array.isEmpty()
|
||||
override fun contains(element: T): Boolean = array.contains(element)
|
||||
override fun get(index: Int): T = array[index]
|
||||
override fun indexOf(element: T): Int = array.indexOf(element)
|
||||
override fun lastIndexOf(element: T): Int = array.lastIndexOf(element)
|
||||
}
|
||||
@@ -10,16 +10,15 @@ import kotlin.reflect.*
|
||||
internal class KTypeParameterImpl(
|
||||
override val name: String,
|
||||
private val containerFqName: String,
|
||||
override val upperBounds: List<KType>,
|
||||
private val upperBoundsArray: Array<KType>,
|
||||
val varianceId: Int, // mapping is used to make static initialization possible
|
||||
override val isReified: Boolean
|
||||
) : KTypeParameter {
|
||||
override val upperBounds: List<KType>
|
||||
get() = upperBoundsArray.asList()
|
||||
override val variance: KVariance
|
||||
get() = KVarianceMapper.varianceById(varianceId)!!
|
||||
|
||||
constructor(name: String, containerFqName: String, upperBounds: List<KType>, variance: KVariance, isReified: Boolean) :
|
||||
this(name, containerFqName, upperBounds, KVarianceMapper.idByVariance(variance), isReified)
|
||||
|
||||
override fun toString(): String = when (variance) {
|
||||
KVariance.INVARIANT -> ""
|
||||
KVariance.IN -> "in "
|
||||
|
||||
Reference in New Issue
Block a user