Simplify concatElements resolution for size=0 and size=1 cases
^KT-40689 fixed
This commit is contained in:
committed by
TeamCityServer
parent
bcfc0c21b1
commit
1dbe7d12a2
+6
-3
@@ -240,15 +240,18 @@ fun argumentsWithVarargAsSingleArray(
|
||||
}
|
||||
}
|
||||
|
||||
if (arraysForConcat.isNotEmpty() || concatElements.isEmpty()) {
|
||||
if (arraysForConcat.isNotEmpty()) {
|
||||
concatElements.add(JsArrayLiteral(arraysForConcat))
|
||||
}
|
||||
|
||||
return concatElements.singleOrNull()
|
||||
?: JsInvocation(
|
||||
return when (concatElements.size) {
|
||||
0 -> JsArrayLiteral()
|
||||
1 -> concatElements[0]
|
||||
else -> JsInvocation(
|
||||
JsNameRef("concat", concatElements.first()),
|
||||
concatElements.drop(1)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun IrFunction.varargParameterIndex() = valueParameters.indexOfFirst { it.varargElementType != null }
|
||||
|
||||
Reference in New Issue
Block a user