Unify componentN templates and add NOTHING_TO_INLINE suppression.

This commit is contained in:
Ilya Gorbunov
2015-07-02 20:56:10 +03:00
parent 9618a3542f
commit f7436064d0
2 changed files with 65 additions and 34 deletions
@@ -13,6 +13,7 @@ import java.util.Collections // TODO: it's temporary while we have java.util.Col
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component1(): T {
return get(0)
}
@@ -20,6 +21,7 @@ public inline fun <T> Array<out T>.component1(): T {
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component1(): Boolean {
return get(0)
}
@@ -27,6 +29,7 @@ public inline fun BooleanArray.component1(): Boolean {
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component1(): Byte {
return get(0)
}
@@ -34,6 +37,7 @@ public inline fun ByteArray.component1(): Byte {
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component1(): Char {
return get(0)
}
@@ -41,6 +45,7 @@ public inline fun CharArray.component1(): Char {
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component1(): Double {
return get(0)
}
@@ -48,6 +53,7 @@ public inline fun DoubleArray.component1(): Double {
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component1(): Float {
return get(0)
}
@@ -55,6 +61,7 @@ public inline fun FloatArray.component1(): Float {
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component1(): Int {
return get(0)
}
@@ -62,6 +69,7 @@ public inline fun IntArray.component1(): Int {
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component1(): Long {
return get(0)
}
@@ -69,6 +77,7 @@ public inline fun LongArray.component1(): Long {
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component1(): Short {
return get(0)
}
@@ -76,6 +85,7 @@ public inline fun ShortArray.component1(): Short {
/**
* Returns 1st *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component1(): T {
return get(0)
}
@@ -83,6 +93,7 @@ public inline fun <T> List<T>.component1(): T {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component2(): T {
return get(1)
}
@@ -90,6 +101,7 @@ public inline fun <T> Array<out T>.component2(): T {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component2(): Boolean {
return get(1)
}
@@ -97,6 +109,7 @@ public inline fun BooleanArray.component2(): Boolean {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component2(): Byte {
return get(1)
}
@@ -104,6 +117,7 @@ public inline fun ByteArray.component2(): Byte {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component2(): Char {
return get(1)
}
@@ -111,6 +125,7 @@ public inline fun CharArray.component2(): Char {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component2(): Double {
return get(1)
}
@@ -118,6 +133,7 @@ public inline fun DoubleArray.component2(): Double {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component2(): Float {
return get(1)
}
@@ -125,6 +141,7 @@ public inline fun FloatArray.component2(): Float {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component2(): Int {
return get(1)
}
@@ -132,6 +149,7 @@ public inline fun IntArray.component2(): Int {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component2(): Long {
return get(1)
}
@@ -139,6 +157,7 @@ public inline fun LongArray.component2(): Long {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component2(): Short {
return get(1)
}
@@ -146,6 +165,7 @@ public inline fun ShortArray.component2(): Short {
/**
* Returns 2nd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component2(): T {
return get(1)
}
@@ -153,6 +173,7 @@ public inline fun <T> List<T>.component2(): T {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component3(): T {
return get(2)
}
@@ -160,6 +181,7 @@ public inline fun <T> Array<out T>.component3(): T {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component3(): Boolean {
return get(2)
}
@@ -167,6 +189,7 @@ public inline fun BooleanArray.component3(): Boolean {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component3(): Byte {
return get(2)
}
@@ -174,6 +197,7 @@ public inline fun ByteArray.component3(): Byte {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component3(): Char {
return get(2)
}
@@ -181,6 +205,7 @@ public inline fun CharArray.component3(): Char {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component3(): Double {
return get(2)
}
@@ -188,6 +213,7 @@ public inline fun DoubleArray.component3(): Double {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component3(): Float {
return get(2)
}
@@ -195,6 +221,7 @@ public inline fun FloatArray.component3(): Float {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component3(): Int {
return get(2)
}
@@ -202,6 +229,7 @@ public inline fun IntArray.component3(): Int {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component3(): Long {
return get(2)
}
@@ -209,6 +237,7 @@ public inline fun LongArray.component3(): Long {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component3(): Short {
return get(2)
}
@@ -216,6 +245,7 @@ public inline fun ShortArray.component3(): Short {
/**
* Returns 3rd *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component3(): T {
return get(2)
}
@@ -223,6 +253,7 @@ public inline fun <T> List<T>.component3(): T {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component4(): T {
return get(3)
}
@@ -230,6 +261,7 @@ public inline fun <T> Array<out T>.component4(): T {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component4(): Boolean {
return get(3)
}
@@ -237,6 +269,7 @@ public inline fun BooleanArray.component4(): Boolean {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component4(): Byte {
return get(3)
}
@@ -244,6 +277,7 @@ public inline fun ByteArray.component4(): Byte {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component4(): Char {
return get(3)
}
@@ -251,6 +285,7 @@ public inline fun CharArray.component4(): Char {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component4(): Double {
return get(3)
}
@@ -258,6 +293,7 @@ public inline fun DoubleArray.component4(): Double {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component4(): Float {
return get(3)
}
@@ -265,6 +301,7 @@ public inline fun FloatArray.component4(): Float {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component4(): Int {
return get(3)
}
@@ -272,6 +309,7 @@ public inline fun IntArray.component4(): Int {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component4(): Long {
return get(3)
}
@@ -279,6 +317,7 @@ public inline fun LongArray.component4(): Long {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component4(): Short {
return get(3)
}
@@ -286,6 +325,7 @@ public inline fun ShortArray.component4(): Short {
/**
* Returns 4th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component4(): T {
return get(3)
}
@@ -293,6 +333,7 @@ public inline fun <T> List<T>.component4(): T {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.component5(): T {
return get(4)
}
@@ -300,6 +341,7 @@ public inline fun <T> Array<out T>.component5(): T {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun BooleanArray.component5(): Boolean {
return get(4)
}
@@ -307,6 +349,7 @@ public inline fun BooleanArray.component5(): Boolean {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ByteArray.component5(): Byte {
return get(4)
}
@@ -314,6 +357,7 @@ public inline fun ByteArray.component5(): Byte {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun CharArray.component5(): Char {
return get(4)
}
@@ -321,6 +365,7 @@ public inline fun CharArray.component5(): Char {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun DoubleArray.component5(): Double {
return get(4)
}
@@ -328,6 +373,7 @@ public inline fun DoubleArray.component5(): Double {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun FloatArray.component5(): Float {
return get(4)
}
@@ -335,6 +381,7 @@ public inline fun FloatArray.component5(): Float {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun IntArray.component5(): Int {
return get(4)
}
@@ -342,6 +389,7 @@ public inline fun IntArray.component5(): Int {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun LongArray.component5(): Long {
return get(4)
}
@@ -349,6 +397,7 @@ public inline fun LongArray.component5(): Long {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun ShortArray.component5(): Short {
return get(4)
}
@@ -356,6 +405,7 @@ public inline fun ShortArray.component5(): Short {
/**
* Returns 5th *element* from the collection.
*/
suppress("NOTHING_TO_INLINE")
public inline fun <T> List<T>.component5(): T {
return get(4)
}