Implement UArray.contains(element) workaround for JS
This commit is contained in:
committed by
Ilya Gorbunov
parent
c1b523ddef
commit
ae47130c8e
@@ -37,7 +37,13 @@ internal constructor(@PublishedApi internal val storage: ByteArray) : Collection
|
||||
override fun nextUByte() = if (index < array.size) array[index++].toUByte() else throw NoSuchElementException(index.toString())
|
||||
}
|
||||
|
||||
override fun contains(element: UByte): Boolean = storage.contains(element.toByte())
|
||||
override fun contains(element: UByte): Boolean {
|
||||
// TODO: Eliminate this check after KT-30016 gets fixed.
|
||||
// Currently JS BE does not generate special bridge method for this method.
|
||||
if ((element as Any?) !is UByte) return false
|
||||
|
||||
return storage.contains(element.toByte())
|
||||
}
|
||||
|
||||
override fun containsAll(elements: Collection<UByte>): Boolean {
|
||||
if ((elements as Collection<Any?>).any { it as? UByte == null }) return false
|
||||
|
||||
Reference in New Issue
Block a user